append-it / blazor.printing Goto Github PK
View Code? Open in Web Editor NEWPrint PDF's using Blazor
Home Page: https://blazor-printing.append.be/
License: MIT License
Print PDF's using Blazor
Home Page: https://blazor-printing.append.be/
License: MIT License
I currently cannot determine when user click Print or Cancle the printing progress , could you please help me
Because the datagrid I am using is to big for a normal print page, I would like to print it horizontally (landscape mode).
But I can't find any option that would allow it.
I've been getting blank pages when printing with Firefox (111). I also tested it with Chromium, and it works fine there.
This appears to be a recent issue, something caused by Firefox itself, because when I originally tested it, it worked. And downgrading the library to an older version didn't help either.
@OnClick="@(_ => PrintingService.Print("printable-form", PrintType.Html))"
<form id="printable-form">
html code..
</form>
Hi there! I've been looking at your library and it seems to do almost everything I need for a project I am working on. We have a new requirement where we need to bypass the dialog and set things like printer name, copies, ect in code. I didn't see any of these properties exposed but wanted to ask and see if this was something available.
If these properties aren't available in the Blazor side of things, does PrintJs allow this?
I want to print from the browser immediately without a print dialog. To do this, you can start the browser in kiosk mode. For example:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://localhost:5000 --kiosk-printing
When you run it, an error will be displayed immediately.I want to print from the browser immediately without a print dialog. To do this, you can start the browser in kiosk mode. For example:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://localhost:5000 --kiosk-printing
When you run it, an error will be displayed immediately
.
How to add page numbers to each page. It is a most important requirement.
Hi, Your Software it's a like a piece of gold! really needed that. Unfortunately I am a beginner with blazor and I cannot understand how to use is with Blazor Server. ( the example is for WASM but there are differences ) would be possible for you to put an example for Blazor Server ?
thank you so much.
i have tried this nuget.
it's not printing. instead downloading the file.
please check and suggest.
Tested afterprint function - works unless printing via PrintingService
Hi
the Blazor.Print works well in an pure Blazor App. I am adding Blazor to an existing MVC / Rzor pages Project. When calling PrintingService.Print in an Razor component and t5his razor component is embedder in an razor Page the script.js could not be doinloaded to the server.
On a pure Blazor project the ImportModule() function try to download the script.js file from _content/Append.Blazor.Printing/scripts.js
if the Razor component is embedded the ImportModule() function try to download the script.js file from XXXXRazorPage_content/Append.Blazor.Printing/scripts.js
I am using this tool in a Web Assembly PWA and I have it printing from html but now I want to be able to give a file a default name when saving it.
Hello,
I've added Install-Package Append.Blazor.Printing to my project. when I try to added to my project by adding "using Append.Blazor.Printing" it does not work.
I can't inject IPrintingService in my program.
My project is a Blazor WASM.
Best regards
Firstly I want to thank you for your efforts and making this library. It is greatly apreciated.
I am getting this error in microsoft edge version 104.0.1293.63 but not google chrome. I have pasted the errors from the browser console below.
Uncaught DOMException: Blocked a frame with origin "http://localhost:51490" from accessing a cross-origin frame.
at u (http://localhost:51490/_content/Append.Blazor.Printing/scripts.js:1:4641)
at n.onload (http://localhost:51490/_content/Append.Blazor.Printing/scripts.js:1:5701)
onError @ scripts.js:1
u @ scripts.js:1
n.onload @ scripts.js:1
load (async)
send @ scripts.js:1
b @ scripts.js:1
(anonymous) @ scripts.js:1
load (async)
m @ scripts.js:1
x @ scripts.js:1
print @ scripts.js:3
(anonymous) @ blazor.webassembly.js:1
beginInvokeJSFromDotNet @ blazor.webassembly.js:1
St @ blazor.webassembly.js:1
_mono_wasm_invoke_js_blazor @ dotnet.6.0.8.5qvbcwublj.js:1
$func219 @ 00971db2:0x1a48f
$func167 @ 00971db2:0xce5d
$func166 @ 00971db2:0xbd70
$func2812 @ 00971db2:0xabf00
$func1616 @ 00971db2:0x6fcc1
$func1620 @ 00971db2:0x7032e
$func3214 @ 00971db2:0xc4e92
$mono_background_exec @ 00971db2:0x9434b
Module._mono_background_exec @ dotnet.6.0.8.5qvbcwublj.js:1
pump_message @ dotnet.6.0.8.5qvbcwublj.js:1
setTimeout (async)
_schedule_background_exec @ dotnet.6.0.8.5qvbcwublj.js:1
$func2389 @ 00971db2:0x942fc
$func3213 @ 00971db2:0xc4e22
$func219 @ 00971db2:0x1a4f7
$func167 @ 00971db2:0xce5d
$func166 @ 00971db2:0xbd70
$func2812 @ 00971db2:0xabf00
$func1616 @ 00971db2:0x6fcc1
$func1614 @ 00971db2:0x6fc33
$func967 @ 00971db2:0x50684
$func219 @ 00971db2:0x1a448
$func167 @ 00971db2:0xce5d
$func166 @ 00971db2:0xbd70
$func2812 @ 00971db2:0xabf00
$func1616 @ 00971db2:0x6fcc1
$func1614 @ 00971db2:0x6fc33
$func967 @ 00971db2:0x50684
$func219 @ 00971db2:0x1a448
$func167 @ 00971db2:0xce5d
$func166 @ 00971db2:0xbd70
$func2812 @ 00971db2:0xabf00
$func1616 @ 00971db2:0x6fcc1
$func1620 @ 00971db2:0x7032e
$mono_wasm_invoke_method @ 00971db2:0x969c
Module._mono_wasm_invoke_method @ dotnet.6.0.8.5qvbcwublj.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet @ managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet:19
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
b @ blazor.webassembly.js:1
invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
invokeWhenHeapUnlocked @ blazor.webassembly.js:1
A @ blazor.webassembly.js:1
N @ blazor.webassembly.js:1
dispatchGlobalEventToAllElements @ blazor.webassembly.js:1
onGlobalEvent @ blazor.webassembly.js:1
Show 28 more frames
I can't seem to find see a way to pass headers to the internal HttpClient. Is there a way?
It's useful if the URL of that serves the PDF requires an authorization header (as any decent API should).
Thanks!
I am converting raw HTML to PDF: await PrintingService.Print(html, PrintType.RawHtml);
The css style applied for printing barcodes is style="font-family: 'connectcode39';"
. But it is not being reflected in the print.
Hello everyone! I'm trying to use the library in my Blazor Server project. But I get an error message. (trying to print Base64).
Microsoft.JSInterop.JSException: "Could not find 'print' ('print' was undefined).
Error: Could not find 'print' ('print' was undefined).
at https://localhost/_framework/blazor.server.js:2:29250
at Array.forEach ()
at n.value (https://localhost/_framework/blazor.server.js:2:29211)
at w (https://localhost/_framework/blazor.server.js:2:28290)
at https://localhost/_framework/blazor.server.js:2:30739
at new Promise ()
at i.beginInvokeJSFromDotNet (https://localhost/_framework/blazor.server.js:2:30713)
at https://localhost/_framework/blazor.server.js:2:111546
at Array.forEach ()
at i.value (https://localhost/_framework/blazor.server.js:2:111517)"
P.S. one more note. I use Blazor.Polifyll to make the app run on the older devices. Even if I include the print.js in my project, it doesn't work.
Maybe someone knows what the problem is?
VG
var test = await DokumentService.PrintPdfFile(selectedItems.Select(s=>s.DocumentId).ToList());
await PrintingService.Print(new PrintOptions(test) { Base64 = true });
Khmer OS Battambang font
Hello,
if i try to print my PDF, i get the error, that the printJS was not found.
blazor.server.js:1 [2023-06-29T10:25:53.508Z] Error: Microsoft.JSInterop.JSException: printJS is not defined ReferenceError: printJS is not defined at Module.print (http://localhost:5019/_content/Append.Blazor.Printing/scripts.js:3:5) at http://localhost:5019/_framework/blazor.server.js:1:3506 at new Promise (<anonymous>) at Ft.beginInvokeJSFromDotNet (http://localhost:5019/_framework/blazor.server.js:1:3480) at Ft._invokeClientMethod (http://localhost:5019/_framework/blazor.server.js:1:75072) at Ft._processIncomingData (http://localhost:5019/_framework/blazor.server.js:1:72696) at Ft.connection.onreceive (http://localhost:5019/_framework/blazor.server.js:1:67009) at i.onmessage (http://localhost:5019/_framework/blazor.server.js:1:51322) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, Object[] args) at Append.Blazor.Printing.PrintingService.Print(PrintOptions options) at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Does not seem to work in mobile browser..
.
Is it possible to print a local PDF file?
example:
string LocalFileName = "C:\Users\work\AppData\Local\Temp\fileExample.pdf";
PrintingService.Print(LocalFileName, showModal: true);
I tried, but without success.
I am currently using the service to print an image element. The problem is, I need to scale the element up when printing. I tried using @media print
and then scale the element there, but it seems the query does not work with this service. Is there a workaround?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.