PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 4:44 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PDF File Size
PostPosted: Thu May 21, 2009 4:06 am 
Offline

Joined: Thu May 21, 2009 4:01 am
Posts: 2
Hi,

First - Thank You to the authors for putting this library together. Great work!

I'm trying to build a C# application to convert JPEG images into PDF files. It works well. The only issue is that the output PDF file size is around 4-5 times larger than that of the original JPEG.

I searched through this forum, and realized that the default setting in PDF Writer is Verbose, and I need to get a 'Release' build.

So to pick up a copy from the 'Release' build (which should use the Compact setting instead), I opened the PdfSharp project in VS C# Express, and built the solution. This created a Release folder in the bin directory, and a PdfSharp.dll file inside.

Using this new dll however does not change the PDF file sizes. They are exactly the same as they were before:

Original JPEG size - Output PDF size
129KB - 582KB
123KB - 484KB

Any ideas?

Thanks.

Sarab


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 25, 2009 7:44 am 
Offline
PDFsharp Guru
User avatar

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

I can't explain this because JPEG files are (or at least should be) copied into the PDF file. The PDF file size should be only few kB larger than the JPEG file size.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 29, 2009 11:07 am 
Offline

Joined: Thu May 21, 2009 4:01 am
Posts: 2
Hmm. Could it be that I'm still not using the 'Release' dll ?
Anything else I can do to make sure that's not the case ?

Thanks...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 02, 2009 10:18 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Are you using the GDI+ build (PDFsharp-VS2008.sln) or the WPF build (PdfSharp-WPF.sln)?

I just noticed that the WPF build treats JPEG images incorrectly. This could explain the increase in size.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 05, 2009 3:27 am 
Offline

Joined: Thu Jun 04, 2009 2:07 pm
Posts: 10
I am hitting the exact same problem. I am using WPF version of it. PdfSharp-WPF.sln.

I spent sometime debugging the problem, looks like the logic of handling Jpeg images in WPF is not working.

In file ximage.cs
string pixelFormat = this.wpfImage.Format.ToString();
switch (pixelFormat)
{
case "Bgr32":
case "Bgra32":
case "Pbgra32":
case "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}": // bmp
case "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}": // png
this.format = XImageFormat.Png;
break;

Even for jpeg it is getting png.


Can I get a fix for this?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 05, 2009 4:27 pm 
Offline

Joined: Thu Jun 04, 2009 2:07 pm
Posts: 10
I changed to use the non WPF version and it is working great. I will switch to WPF version once it is fixed. Also I noticed that WPF version does not load multi page tiff files. I did not do much research though.


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

All times are UTC


Who is online

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