Sorry, I forgot the watermark....

Also, it doesn't matter if it CCITT or not, as long as it prints....

Thanks!
Jared

Paulo Soares wrote:

> I can't open itext.pdf in Acrobat 5.0 although I can do it in 4.0. The jpg
> image in both is not the same. Send me all the files required to build the
> pdf (and the code). By the way, if you use a CCITT image or transparency you
> need postscript level 3 to print it.
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: Jared Ellson [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, April 25, 2002 17:54
> > To:   [EMAIL PROTECTED]
> > Subject:      [iText-questions] HELP!!  PDF/PS printing experts needed!!
> >
> >  Hi All,
> >
> > I have been working on a printing issue for a while.  I currently use
> > iText to convert scanned .tiff documents to PDFs for a large paperless
> > application here at Sun.  The problem that I have encountered is that
> > the PDF that iText created from tiffs are not printable, I get a
> > typecheck-restore error.  I have tried from many versions of Acrobat,
> > and even tried with Ghostscript.  If I use Ghostscript to convert the
> > PDF's to PS the postscript will not print however, if I use ghostscript
> > to "convert" a pdf to a pdf using the following command:
> >
> > gs -q -dNOPAUSE -dBATCH  -sDEVICE=pdfwrite -sOutputFile=./itext-gs.pdf
> > ./itext.pdf
> >
> > the PDF becomes printable from Acroread or Ghostscript.  I have looked
> > at the contents of the two PDFs and don't see any significant
> > differences.  The encoding is the same..
> >
> > I have attached example PDFs, one that doesn't print - itext.pdf
> > (created from iText) and the same PDF after the ghostscript command has
> > been run on it and it is printable - itext-gs.pdf.  If someone can take
> > a look at these and give me an idea where to start or if it is a
> > limitation of iText, please let me know as I have about 9000 documents a
> > day that go through this process and need to fix it soon before I have
> > to run the gs command on hundreds of thousands of PDFs.
> >
> > Thank you!!
> > Jared
> >
> > Also, here is the code that converts the tiffs to PDFs:
> >
> > public boolean tiffToPdf(String theTiffFile, String theOutFile)
> >     {
> >      Document document = null;
> >
> >         try {
> >             // creation of the different writers
> >
> >             File file = new File(theTiffFile);
> >             SeekableStream s = new FileSeekableStream(file);
> >             TIFFDirectory dir = new TIFFDirectory(s, 0);
> >             long IFDOffset = dir.getIFDOffset();
> >              Watermark watermark = null;
> >             PdfWriter writer = null;
> >             PdfContentByte cb = null;
> >
> >
> >             while (IFDOffset != 0L) {
> >                 dir = new TIFFDirectory(s, IFDOffset, 0);
> >                 IFDOffset = dir.getNextIFDOffset();
> >                 long h =
> > dir.getFieldAsLong(TIFFImageDecoder.TIFF_IMAGE_LENGTH);
> >                 long w =
> > dir.getFieldAsLong(TIFFImageDecoder.TIFF_IMAGE_WIDTH);
> >
> >                 if (document == null)
> >                 {
> >                     if((int)w > 1800)
> >                     {
> >                     watermark = new
> > Watermark(Image.getInstance(ConverterProperties.WATERMARKLOC),0,-150);
> >                     document = new Document(PageSize.A4.rotate(), 50,
> > 50, 50, 50);
> >                     }
> >                     else
> >                     {
> >                        watermark = new
> > Watermark(Image.getInstance(ConverterProperties.WATERMARKLOC),0,0);
> >                         document = new Document(PageSize.A4, 50, 50, 50,
> > 50);
> >                     }
> >                     writer = PdfWriter.getInstance(document, new
> > FileOutputStream(theOutFile));
> >                     cb = writer.getDirectContent();
> >                     document.add(watermark);
> >
> >                     document.open();
> >                 }
> >                 else
> >                 {
> >                     if((int)w > 1700)
> >                     {
> >                         document.setPageSize(PageSize.A4.rotate());
> >                     }
> >                     else
> >                     {
> >                         document.setPageSize(PageSize.A4);
> >                     }
> >                 }
> >                 long offset =
> > dir.getFieldAsLong(TIFFImageDecoder.TIFF_STRIP_OFFSETS);
> >                 long size =
> > dir.getFieldAsLong(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS);
> >                 boolean reverse = false;
> >                 if (dir.isTagPresent(TIFFImageDecoder.TIFF_FILL_ORDER))
> >                     reverse =
> > (dir.getFieldAsLong(TIFFImageDecoder.TIFF_FILL_ORDER) == 2L);
> >                 int compression =
> > (int)dir.getFieldAsLong(TIFFImageDecoder.TIFF_COMPRESSION);
> >                 switch (compression) {
> >                     case TIFFImage.COMP_FAX_G3_1D:
> >                         compression = Image.CCITTG3_1D;
> >                         break;
> >                     case TIFFImage.COMP_FAX_G3_2D:
> >                         compression = Image.CCITTG3_1D;
> >                         if
> > (dir.isTagPresent(TIFFImageDecoder.TIFF_T4_OPTIONS)) {
> >                             if
> > (((int)dir.getFieldAsLong(TIFFImageDecoder.TIFF_T4_OPTIONS) & 1) != 0)
> >                                 compression = Image.CCITTG3_2D;
> >                         }
> >                         break;
> >                     case TIFFImage.COMP_FAX_G4_2D:
> >                         compression = Image.CCITTG4;
> >                         break;
> >                     default:
> >                         throw new Exception("Compression type " +
> > compression + " not supported");
> >                 }
> >                 byte im[] = new byte[(int)size];
> >                 s.seek(offset);
> >                 s.readFully(im);
> >                 Image img = Image.getInstance((int)w, (int)h, reverse,
> > compression, 0, im);
> >
> >                 img.scalePercent(72f / 200f * 100);
> >                 img.setAbsolutePosition(0, 0);
> >
> >
> >
> >
> >                 cb.addImage(img);
> >
> >
> >                 document.newPage();
> >             }
> >             document.close();
> >             return true;
> >         }
> >         catch (Exception de) {
> >             de.printStackTrace();
> >             createErrorPDF(theTiffFile, theOutFile);
> >             return false;
> >         }
> >
> >
> >
> >
> >
> >
> >     } << File: itext-gs.pdf >>  << File: itext.pdf >>
>
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions

<<inline: watermark.jpg>>

Reply via email to