PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 2:48 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Aug 22, 2008 11:23 am 
Offline

Joined: Thu Aug 21, 2008 9:01 pm
Posts: 4
Location: New York
I have an application that uses a GIS framework to export a PDF document (which is basically a map). I then need to stamp this PDF with some custom information (just two lines of simple text) for which I use PDFSharp and create a new PDF document. The utility works great. The only problem is that the size of the resultant document (created by PDFSharp) is so much larger. For eg: one PDF file that was orginally 184KB became 712KB when created with PDF Sharp. Now the PDF Exporter of the GIS framework has a DPI setting. Is there something similar with PDFSharp?

here is the code i used to generated the PDF.

pdfDocument = PdfReader.Open(inputFile)
For Each page As PdfPage In pdfDocument.Pages
Dim xgfx As XGraphics = XGraphics.FromPdfPage(page)
xgfx.DrawString("As of Date : " + effectiveDate, dateFont, XBrushes.Black, effDateLocation)
page.Close()
Next
pdfDocument.Save(outputFile)
pdfDocument.Close()


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 25, 2008 7:33 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Are you using a DEBUG build of PDFsharp?
Have you tried a RELEASE build?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 25, 2008 11:19 pm 
Offline

Joined: Thu Aug 21, 2008 9:01 pm
Posts: 4
Location: New York
Hi Thomas,

Thanks for your reply. I was able to fix the problem. After I got a reference to the PDFDocument object, I set two of its properties:

PDFDocument.CompressContentStreams = True
PDFDocument.NoCompression = False

and that seemed to do the job. Now the size of the new PDF is only marginally larger than the original PDF (which is expected).


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 380 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