PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Thu Oct 02, 2025 8:04 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 26, 2014 11:07 am 
Offline

Joined: Wed Sep 24, 2014 12:02 pm
Posts: 2
Hi,

As a part of evaluation, i have prepared a sample application which basically take the list of Tiff Files to generate MultiPage PDF. As a output MultiPage PDF, Only First Page will have the actual first Tiff Image, the rest of the pages shows Blank Page. Also, it shows an error message "Insufficient Data for an image." while opening that PDF file.

Moreover, if i use Jpeg Images then it will add those images to MultiPage PDF. Also, if i use DrawString method as per below commented code then it will add specific text in each page.

Below are the code details.

Code:
            Dim pdfDocument As New PdfSharp.Pdf.PdfDocument
            Dim i As Int32 = 0
            For Each FilePath As String In FileNames
                Dim m_BinaryData As Byte() = System.IO.File.ReadAllBytes(FilePath)
                m_Stream = New MemoryStream(m_BinaryData)
                Dim inBitmap As New Bitmap(m_Stream)

                Dim oPage As PdfSharp.Pdf.PdfPage = pdfDocument.AddPage()

                Dim xgr As PdfSharp.Drawing.XGraphics = PdfSharp.Drawing.XGraphics.FromPdfPage(oPage)
                Dim img As PdfSharp.Drawing.XImage = PdfSharp.Drawing.XImage.FromGdiPlusImage(inBitmap)
                xgr.DrawImage(inBitmap, 0, 0)

                'Dim printFontCour8 = New PdfSharp.Drawing.XFont("Courier New", 8, PdfSharp.Drawing.XFontStyle.Regular)
                'xgr.DrawString("Yahoo", printFontCour8, Brushes.Black, New PdfSharp.Drawing.XPoint(400, 400))

                xgr.Dispose()
                i = i + 1
            Next
            pdfDocument.Save(modifiedFilePath)
            pdfDocument.Close()


Please Suggest !!


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 27, 2014 12:24 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 354
dinesh wrote:
Below are the code details.
I see just a code snippet, but no sample TIFF files.
I see image files being opened in a complicated way instead of passing the path directly to XImage.
See also:
viewtopic.php?f=2&t=832
http://pdfsharp.net/wiki/Graphics-sampl ... al_size_20

If you are using PDFsharp 1.32, then maybe go back go 1.31 and give it a try.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 31, 2015 10:07 am 
Offline

Joined: Fri Dec 19, 2014 1:46 am
Posts: 8
I directly use TIFF to PDF converter control, and I get the Code sample from the developer guide on RasterEdge.
but it only have 30 days trial, if you need to convert PDF, you can download its demo for testing.


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: Google [Bot], Google Adsense [Bot] and 433 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