PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Tiff to PDF Conversion Issue
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2935
Page 1 of 1

Author:  dinesh [ Fri Sep 26, 2014 11:07 am ]
Post subject:  Tiff to PDF Conversion Issue

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 !!

Author:  () => true [ Sat Sep 27, 2014 12:24 pm ]
Post subject:  Re: Tiff to PDF Conversion Issue

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.

Author:  calosteward [ Fri Jul 31, 2015 10:07 am ]
Post subject:  Re: Tiff to PDF Conversion Issue

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/