Hi,

I've been able to create a PDF using the input TIF. Here's my cod, (it 
is Java code, but it should be simple enough to port ;) )

img = TiffImage.getTiffImage(new RandomAccessFileOrArray(new 
RandomAccessSourceFactory().createBestSource(imagePath)), CATCH_ERRORS, 
PAGE_NUMBER, TIFF_DIRECT);

CATCH_ERRORS and TIFF_DIRECT are two variables set to true.

This should work on the provided TIF.

Do note, that this is not guaranteed to work on every corrupt tif, 
because your tif _is_ corrupted.


Kind regards,
Michaël.


stefyg85 schreef op 26/08/2014 13:25:
> Hello,
> I'm having some problem converting this tiff file in pdf.
>
> 335D6.tif
> <http://itext-general.2136553.n4.nabble.com/file/n4660273/335D6.tif>
>
> The function TiffImage.GetTiffImage throw me "EndOfStreamException".
> I know there are similar questions and maybe the problem is that the tiff
> file is somehow corrupted but could you please give me some advice?
>
> GetNumberOfPages function returns the correct number of pages (2)
>
> This is my code:
>
> lv_RandomArray = New iTextSharp.text.pdf.RandomAccessFileOrArray(lp_RasFile)
> lv_NumPages = lv_TiffImage.GetNumberOfPages(lv_RandomArray)
>
> lv_PDFDoc = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4)
>
> lv_OutputPdfStream = File.Create(lp_OutFile)
>
> lv_PdfWriter = PdfWriter.GetInstance(lv_PDFDoc, lv_OutputPdfStream)
> lv_PdfWriter.StrictImageSequence = True
>
> lv_PDFDoc.Open()
>
>   For lv_Index As Integer = 1 To lv_NumPages
>                lv_Image =
> iTextSharp.text.pdf.codec.TiffImage.GetTiffImage(lv_RandomArray, lv_Index)
>                lv_Image.CompressionLevel = PdfStream.BEST_COMPRESSION
>                lv_Image.SetAbsolutePosition(0, 0)
>                lv_Image.ScaleAbsolute(lv_PDFDoc.PageSize.Width,
> lv_PDFDoc.PageSize.Height)
>                lv_PDFDoc.Add(lv_Image)
>                lv_PDFDoc.NewPage()
>   Next
>
> Thanks in advance for any help!
> Stefy
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://itext-general.2136553.n4.nabble.com/EndOfStreamException-on-TiffImage-GetTiffImage-tp4660273.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a 
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: 
> http://itextpdf.com/themes/keywords.php
>


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to