PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon Nov 02, 2009 1:46 am 
Offline

Joined: Mon Nov 02, 2009 1:17 am
Posts: 1
I have a custom bar code generator which produces a bmp imagefile. When adding this into Migradoc (using Paragraph.Add(Image), the result is that the bars become blurred. What causes this? Rendering? Ratios of initial vs. final resolutions? ... How can I avoid this? I.e., can I force Migradoc to allow a specified size for an image it is adding (if that is what is causing it).

I've added screen shots of the original image and the resulting Migradoc file.

Thanks.


Attachments:
Initial image file.PNG
Initial image file.PNG [ 7.82 KiB | Viewed 10971 times ]
After added into Migradoc document.JPG
After added into Migradoc document.JPG [ 27.49 KiB | Viewed 10971 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 02, 2009 9:41 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Adobe Reader causes this blurriness.
You can turn it off in the display options of your Reader (but on other computers it will be on by default). AFAIK this cannot be turned of using options in the PDF file.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 16, 2009 5:16 pm 
Offline

Joined: Thu Nov 12, 2009 11:50 am
Posts: 5
The same thing happens in rtf documents using MigraDoc - is this a bug?

If not, what's missing from code to prevent this happening?


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 17, 2009 9:59 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Pete wrote:
The same thing happens in rtf documents using MigraDoc - is this a bug?
If not, what's missing from code to prevent this happening?


It's not a bug, it's a feature. A feature of the program that displays the documents.

In Adobe Reader, the "Blurriness" feature is called "Smoothing".
Go to "Preferences", then "Page Display"; in the "Rendering" group box, disable "Smooth line art" and "Smooth images" to avoid blurriness.
Adobe Reader will still smooth some images ...

And AFAIK it's not possible to override these user-preferences with document options.

It seems that Word will always smooth the images. So when viewing RTF with Word, there is no way I know to avoid blurriness.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 18, 2009 1:33 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
The PDF file can contain a hint to the display program indicating whether interpolation of image data is requested.

You can say no in your code:
Code:
XImage image = XImage.FromFile(file);
image.Interpolate = false;


It's a hint, so it may not always prevent blurriness.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2009 10:49 am 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi,

I have noticed that when using bitmap images, they seem to display at roughly twice the size when viewed at 100% in acrobat reader than they do when viewed at 100% in photoshop, is this becuase of the difference in the DPI of the PDF? its not a big problem, but if I knew why it happens, then I could make my images "correctly" first time, rather than creating them, realising they are too big and then re-sizing them.

mike


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2009 12:12 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
mikesowerbutts wrote:
I have noticed that when using bitmap images, they seem to display at roughly twice the size when viewed at 100% in acrobat reader than they do when viewed at 100% in photoshop, is this becuase of the difference in the DPI of the PDF?

PhotoShop is pixel-based: 100% in PhotoShop means every pixel of the picture will have exactly one pixel on the display.

PDF is vector-based: 100% in Adobe Reader means the page on screen has the same size as the page on paper (Windows knows the physical size of your monitor).

If you specify width and height in MigraDoc, these values will be used; otherwise width and height as specified in PhotoShop will be used.
An image that is 300 pixels wide can be set to 1 cm, 1 inch, 5 cm, or anything else in PhotoShop.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

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