PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Apr 25, 2024 9:11 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Printing without preview
PostPosted: Mon Feb 23, 2015 4:55 pm 
Offline

Joined: Sun Dec 07, 2014 1:03 pm
Posts: 18
Hello

I am pretty sure, that I have seen it somewhere in the samples, but I can not find it anymore.
I want to create a pdf which should be printed on the main printer (or any other?) without any preview.

Thanks for Help
mgbig


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 23, 2015 4:59 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

PDFsharp cannot print PDF files.

You can create a PDF file and then invoke Adobe Reader to print (via command line options).

Or run your code twice: first to create a PDF, then to print it.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 23, 2015 6:40 pm 
Offline

Joined: Sun Dec 07, 2014 1:03 pm
Posts: 18
Ok! What you tell is what I want.

And this is what I actually do:
all VB.NET

Code:
pdfRenderer.PdfDocument.Save(filename)
Process.Start(filename)


And I tried this and this works, but after printing the Adobe Icon stays in the task bar, which is not very nice. Is there a better way?
Code:
...
pdfRenderer.PdfDocument.Save(filename)
Print_Document(filename)
...

Private Sub Print_Document(ByVal strDocpath As String)
        Dim p As New Process
        p.StartInfo.FileName = strDocpath
        p.StartInfo.Verb = "print"
        p.StartInfo.CreateNoWindow = True
        p.Start()
End Sub


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 27, 2015 7:52 am 
Offline

Joined: Sun Dec 07, 2014 1:03 pm
Posts: 18
Finally it works well like this:

I found this pdf viewer "SumatraPDF" which is very smart and fast. and it works nice with this VB Net Code:
Code:
Process.Start("C:\projekte\SumatraPDF\SumatraPDF.exe", "-silent -exit-on-print -print-to-default " & filename)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 299 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group