PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri May 03, 2024 2:00 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu May 27, 2010 2:39 pm 
Offline

Joined: Thu May 27, 2010 2:25 pm
Posts: 9
Hello,
I have strange problem with printed version of PDF document. I'm using only PDFSharp to create document (not MigraDoc) and document looks like this:
There's an A4 image over entire background (originally from PNG image, white backgrounded).
Over this image, there's some text and other images, also from PNG images, but transparent.

Rendering works fine and document looks perfect in PDF viewer (tested on Adobe PDF Reader 9.3 and 7.0). BUT when I print this document on printer, it creates black border line around inner shapes of the image - see scan.jpg from attachment.

scan.jpg - small unreadable letters and horizontal line comes from background image. Big "P" letter comes from transparent PNG image (not text) and around that "P" image is white border (actually small gradient inside original image, that's ok) and unwanted 1px tight black border.

scan.jpg is printed and scanned (because PDF looks fine in viewer), therefore it has low quality, but the unwanted 1px black border is sharp-looking on paper (pure black, sharp edges, recognisible pixels).

Any ideas how to fix this?

PdfDocument.Version = 14 (as suggested to check in other posts)
PdfSharp version 1.31.1789

Thanks in advance

PavlinII


Attachments:
scan.jpg
scan.jpg [ 15.38 KiB | Viewed 12119 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu May 27, 2010 2:59 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
PavlinII wrote:
Big "P" letter comes from transparent PNG image (not text)

I can't see your PNG file and I don't know your printer.

Does this happen with all printer? Maybe it's a printer driver problem.

Does the PNG file use alpha blending? This works with PDF and PDFsharp (and looks correct on the screen), but could be the cause of the printing problem.

Only wild guesses after looking at your scanned image ...

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Sat May 29, 2010 8:07 am 
Offline

Joined: Thu May 27, 2010 2:25 pm
Posts: 9
Hi,
thank you for narrowing suspects.

PNG:
Original PNG "P"-file is in attachement.

I've forgot mentioned, that it's resized during rendering to fit it's location/size. :(
Dim R As New XRect(..double.., ..double.., ..double.., ..double..)
Gfx.DrawImage(XImage.FromFile(FileName), R)
But I've tried to remove resizing and problem remains:
Gfx.DrawImage(XImage.FromFile(FileName), x, y)

I'm sorry, but I don't know what "alpha blending" exactly means. File comes from Photoshop (just save as PNG, no special settings), contains 100% transparent pixels, does not contains semi-transparent pixels.

Printer:
HP Color LaserJet CM1312nfi MFP (only 6 months old), original driver, WinXP
Everything else prints just fine.
I don't have any other printer available now. I'll try to send it to somebody else on monday.

PavlinII

---Edit:---
I've added X.png - much smaller image (only black and 100% transparent pixels) with exactly the same problem.


Attachments:
X.png
X.png [ 1021 Bytes | Viewed 12111 times ]
P.png
P.png [ 14.81 KiB | Viewed 12111 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon May 31, 2010 7:20 am 
Offline

Joined: Thu May 27, 2010 2:25 pm
Posts: 9
Hello again,
I've tested PDF print in another environment (Adobe Reader 9.3.1, printer IBM Infoprint 1570 MFP) and printed image looks fine, without borders.

BUT my application is web-based, PDF documents will be printed on hundreds different locations (by substandard users) and I have absolutely no control about their printers and drivers (and they have usualy absolutely no idea what driver is).

So I need to fix this anyway :(


Top
 Profile  
Reply with quote  
PostPosted: Mon May 31, 2010 7:41 am 
Offline
PDFsharp Guru
User avatar

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

If your images only use 0 % or 100 % transparency, you can try setting PdfDocument.Version to 13. This could make a difference.

There are thousands of printer drivers around. No chance to test them all.
The PDF Reader sends the document to the printer. A different Adobe Reader version (Adobe Reader 4.0 or newer recommended) could work with your printer.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon May 31, 2010 8:59 am 
Offline

Joined: Thu May 27, 2010 2:25 pm
Posts: 9
Hi,
version 13 did not help, problem remains :(

(I've set Doc.Version=13 just after creating instance of PdfDocument class and before building content)


Top
 Profile  
Reply with quote  
PostPosted: Mon May 31, 2010 9:52 am 
Offline

Joined: Thu May 27, 2010 2:25 pm
Posts: 9
Hi,
another test: Adobe Reader 9.0, HP LaserJet 4250dtn and HP Color LaserJet 5500dn. So more than one HP printer have this problem and I can't ignore it :-/

I've tried to remove background image and problem still remains (so overlaying images does not cause this).

I've tried to print 5th page of GDI+ version of this sample http://www.pdfsharp.net/wiki/Graphics-sample.ashx and bounding border did not appeared. There must be something wrong with my PNG files or my code.

Code:
Dim Doc As New PdfDocument, Pg As PdfPage, R As New XRect(fX * cX, fY * cY, fWidth * cX, fHeight * cY)
Dim fFont As New XFont("Tahoma", 8, XFontStyle.Regular, New XPdfFontOptions(PdfFontEncoding.Unicode))
Dim fStringFormat As New XStringFormat() With {.LineAlignment = XLineAlignment.Near}
Pg = Ret.Pages.Add
Using G As XGraphics = XGraphics.FromPdfPage(Pg)
  G.DrawImage(XImage.FromFile(fn...), New XRect(0, 0, G.PdfPage.Width.Point, G.PdfPage.Height.Point)) 'BackGround
  ...several string drawings...
  R = New XRect(....)
  G.DrawString("Some string", fFont, XBrushes.Black, R, fStringFormat)
  R = New XRect(....)
  G.DrawImage(XImage.FromFile(fn...), R)    'X.png or P.png
End Using

Am I missing some element wrapping or something?


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 09, 2010 2:13 pm 
Offline

Joined: Thu May 27, 2010 2:25 pm
Posts: 9
No idea what's wrong? :(


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 05, 2014 3:50 pm 
Offline

Joined: Wed Feb 26, 2014 3:48 pm
Posts: 8
Hello all;

Hoping you might still be following this one Thomas. I have a similar concern. Please see attached in general. I did try to upload some pdf's but they would not upload.

In the image tempPrintCapture.jpg you can see the gradient filled bounding box. This is the way the document should look. The logo to the right is outside of the bounding box of the gradient fill.

Attachment:
tempPrintCapture.JPG
tempPrintCapture.JPG [ 44.88 KiB | Viewed 10772 times ]



The image tempPrintCapture2.jpg shows what is happening when I print the pdf. This occurs when printing to a printer or to a pdf file. I have removed both the text and the logo as a test. The printed gradient fill still does not change from the image shown below.

Attachment:
tempPrintCapture2.JPG
tempPrintCapture2.JPG [ 39.27 KiB | Viewed 10772 times ]



I tried printing the Lines and Curves sample but am unable to get the gradient to print (using a simple b&w copier as the printer).

Our IT guy came across a solution. He found within the advanced settings (see dialog.jpg) that if we switch this setting from "Image / Vector / Grid" (this is apparently the default setting) to "Image" as shown below, the bounding box gradient fill prints appropriately. We are using BlueBeam but I'm not sure that this is not a concern as it seems to be the case with every print driver I have access to. If I print with the "Image" setting it prints. It appears that "Grid" will also work, though I did not test this extensively.

Attachment:
dialog.jpg
dialog.jpg [ 96.18 KiB | Viewed 10772 times ]


My question is do we have access, via PDFsharp or MigraDoc, to this print driver setting. My guess is no, but I need to ask. I was unable to find it in PDFsharp.

As I stated earlier, I tried to attach the pdf files but was unable to. If this is possible could you direct me how to do this?

I don't believe it has to do with the code that is in my app because I simply copied and pasted directly from the samples provided. From there I changed the colors, fonts and locations of the output from the samples.

Thank you very much for your assistance.

Have a Great Day!! :D

Frank Pytel


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 05, 2014 4:11 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
Hi!
frankpytel wrote:
As I stated earlier, I tried to attach the pdf files but was unable to. If this is possible could you direct me how to do this?
ZIP it and attach it (IIRC up to 256 kiB are OK).

PDFsharp includes a class that calls Adobe Reader to print PDF files - but you cannot change printer settings when you use this class.

If the PDF looks correct on the screen but prints incorrectly (correctly with certain printer settings), then it's most likely a printer problem.

Maybe create a PNG or JPEG with the gradient and try that as a background. PDF files might be larger, but could be a workaround for the printer problem.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

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