PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Mar 01, 2017 12:19 pm 
Offline

Joined: Wed Mar 01, 2017 9:11 am
Posts: 1
I still do not know why, but it only happens in a particular case.
If the PDF loaded contains a png image with transparency when adding one image in the page it transforms the text of the page into image.
If the PDF contains a jpg image it works.
Just go with png with transparency.

The source code to introduce the image to the pdf that I use is:
Code:
 
        Dim oDocument As PdfSharp.Pdf.PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open("c:\doc.pdf", PdfDocumentOpenMode.Modify)
        Dim oPage As PdfSharp.Pdf.PdfPage = oDocument.Pages(1)

        Dim gfx As PdfSharp.Drawing.XGraphics = PdfSharp.Drawing.XGraphics.FromPdfPage(oPage)
        Dim oStream As New System.IO.MemoryStream
        oImg.Save(oStream, ImageFormat.Png)
        oStream.Position = 0
        Dim oImage As PdfSharp.Drawing.XImage = PdfSharp.Drawing.XImage.FromStream(oStream)
        gfx.DrawImage(oImage, oPosition.X, oPosition.Y, oImage.PixelWidth, oImage.PixelHeight)
        oDocument.Save("c:\docMod.pdf")
        oDocument.Close()


Any idea what may be going on?

thanks


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 01, 2017 1:45 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
s3rman wrote:
Any idea what may be going on?
Text on pages containing transparent objects may look different in Adobe Reader than text on pages without any transparency.
The effect varies, depending on the properties set in Adobe Reader.

I am sure that PDFsharp does not convert your text to an image.

Maybe things will look better if you set the version of the PDF file to 1.3.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 119 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