How is bitsPerRate set for PDF to TIFF conversion?

I need to convert a PDF to a group 4 TIFF. I found certain objects I need to set to accomplish this (code is below). I am getting the exception below when performing the "write sequence" methon on the TIFF writer. I am wondering if anyone can offer any insight on how the bits per sample property is set and how can i change it?<br>:<br>
Thanks:<br>:<br>
Brian<br>
EXCEPTION:<br>
<br>
javax.imageio.IIOException: Bits per sample must be 1 for T4 compression!<br>
at com.sun.media.imageioimpl.plugins.tiff.TIFFT4Compressor.encode(TIFFT4Compressor.java:219)<br>
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.writeTile(TIFFImageWriter.java:1256).<br>
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.write(TIFFImageWriter.java:1555)<br>
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.writeInsert(TIFFImageWriter.java:1683)<br>
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.writeToSequence(TIFFImageWriter.java:1598)<br>
<br><br>
CODE:<br>
<br>
public static byte[] PDFToImage(byte[] bai, String imageType) <br>
{<br>
byte[] out = null; <br>
try <br>
{<br>
     PdfDecoder decoder = new PdfDecoder();<br>
     decoder.openPdfArray(bai);<br>
     if(decoder.isFileViewable()) <br>
     {<br>
          ByteArrayOutputStream baos = new ByteArrayOutputStream();<br>
          ImageOutputStream ios = ImageIO.createImageOutputStream(baos);<br>
          boolean foundWriter = false;<br>                    
          Iterator writerIter = ImageIO.getImageWritersByMIMEType("image/" + imageType);<br>
          while (writerIter.hasNext() && !foundWriter) <br>
          {<br>
               foundWriter = true;<br>
               TIFFImageWriter writer = (TIFFImageWriter)writerIter.next();<br>
               writer.setOutput(ios);<br>
               TIFFImageWriteParam param = new TIFFImageWriteParam(new Locale("en"));<br>
               param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);<br>
               param.setCompressionType("CCITT T.4");<br>
               param.setCompressionQuality(1);<br>
          writer.prepareWriteSequence(null);<br>
               for (int i = 0; i < decoder.getPageCount(); i++) <br>
               {<br>
                    int pageNumber = i + 1;<br>
                    BufferedImage image = decoder.getPageAsImage(pageNumber);<br>
                    IIOImage iioImage = new IIOImage(image, null, null);<br>
                    try{<br>
                         writer.writeToSequence(iioImage, param);<br>
                    }catch(Exception e){<br>
                         throw e;<br>
                    }<br>
                    if(i==2)<br>
                    break;<br>
               }<br>
               writer.endWriteSequence();<br>
               ios.flush();<br>
               writer.dispose();<br>
               ios.close();<br>
               out = baos.toByteArray();<br>
          }<br>
          if (!foundWriter) <br>
          {<br>
               throw new RuntimeException("Error: no writer found for image type '"
                                   + imageType
                                   + "'");<br>
          }<br>
     }<br>
     decoder.closePdfFile();<br>
} <br>
catch (Exception e) <br>
{<br>
     e.printStackTrace();<br>
}<br>
return out;<br>
}<br>
Message was edited by:
breaknine

I'm facing same problem!!!

Similar Messages

  • How can I set 'Adobe PDF printer' as one of my printer choices?

    I've given it half an hour. Can't seem to figure out how I can set 'Adobe PDF printer' as one of my printer options. I'm not sure if I need to download an Adobe file, and what folder I might need to place it in, and if I also need to add a specific driver.
    I'm trying to create a PDF file that printers and outfits like www.lulu.com will accept. Printing an MS Word document via 'Adobe PDF printer' will allow me, I'm told, to produce a suitable PDF file.
    Ideally I'm producing the original document in Pages - but I've been told by printers and lulu.com et. al. that no one out there likes PDF's produced by Pages ("not professional").
    Any suggestions you might have would be most appreciated...
    Ben

    Ben Low wrote:
    I downloaded the Lulu Adobe PDF joboptions file ... but it didn't come with any instructions on how to install or use it. I just have the file. I opened it with a double click and got Adobe Distiller - and I can 'see' what the settings are, but I'd love to understand how to install it so it becomes a selection when I export from Pages.
    Forget the Lulu instruction about double click to install. Quit Acobat Distiller and Acrobat Pro. Move the Lulu joboptions file to the Adobe PDF Settings folder. The path to it is:
    HD/Library/Application Support/Adobe PDF/Settings/
    or
    HD/Library/Application Support/Adobe/Adobe PDF/Settings/
    You're in the right folder when you see other joboptions files already in the Settings folder.
    Next, launch Pages and open your document.
    From the File menu, select Page Setup. In that window, select Adobe PDF 7 for "Format for," choose your paper size, orientation and scale % and click OK.
    From the File menu, select Print
    In the Print window, be sure the Printer is Adobe PDF 7
    Click on Layout for a pop down list and select PDF Options
    To the right of "Adobe PDF Settings" click for a pop up list and select Lulu
    Click Print
    HTH

  • How do I set a PDF Export Preset to force a minimum line weight on output?

    How do I set a PDF Export Preset to force a minimum line weight on output?  I'm currently using one that came from a printer that works great - but I can't seem to find the option when creating one myself.  I have some placed Illustrator line art that is built with .25 line thickness and when I have it placed at 20% scale the lines are too thin to see in the PDF output.

    There is absolutely no way to force minimum line widths within InDesign itself, certainly not as part of the PDF export process!! And even one writes a script to go through every object within an InDesign document and both validate and fix line widths less than some particular threshold, such a script would be useless against placed artwork, the contents of which are not available for manual or programmatic inspection within InDesign.
    Note that one should be exceptionally careful in “fixing” hairlines, especially if you are placing vector artwork at very low magnification. It may actually be OK to let certain lines drop out. After a fixup on some content, you could end up with a messy mass of lines.
              - Dov

  • How to create link for pdf file in discoverer worksheet

    Hi All,
    I would like to create a link for pdf file into discoverer report (worksheet).
    So that i can open linked pdf file using worksheet link.
    Can any one tell me about this?
    Thanks
    Ravi

    Hi,
    I think the best way to do this is to use a database directory so that you can access your pdf file as a bfile. Then create a mod_plsql procedure that sets the mime type and downloads the pdf file. You then create a calculation in the EUL then returns the URL to your mod_plsql procedure. You can then include this calculation as a hyperlink in your worksheet.
    It is not as difficult as it sounds. Please let me know if you need anymore details.
    Rod West

  • HELP!  How do I set the pdf so the user can fill it in and "save as" but protect original pdf?

    I created the pdf form and extended user rights which allows the end user to fill the form in.  However, if they press "Save" instead of "Save As" they overwrite the original pdf.  How can I protect the pdf so they cannot overwrite it but they can use the "Save As" option after filling in the form?

    But guys, aren't there PDF's on the internet that are write-protected so that even if you open it and interact with it (view it) it does not allow you to save changes?  I have seen this before -- a dialog box comes up saying that editing of the PDF file is not possible.
    I have also seen files where you can "Save a Copy As..."

  • Font Setting for PDF

    Hi Experts,
    I am downloading the PDF format of the smartform through cprojects. In the smartform I have used my own Z style which uses ARIAL as the font. But when I view the PDF format of the smartform, the font is taken as ‘Courier’.  The Document property of ADOBE READER shows ‘Courier’ as the font rather than ‘Arial’. Please provide any settings for PDF/smartform if required to get the necessary font.
    Helpful answers will be rewarded points.
    Thanks and Regards,
    Sagar Sonje

    Hi,
    while converting the file u r using ITCOO structure. in this u can define the desired font of the PDf output.
    plz check it.
    in the include RSTXDATAOTF  find
    pc_id_gui_call_font  like itcoo-tdprintcom value 'GF',
    pc_id_gui_font_name  like itcoo-tdprintcom value 'GN',
    plz verify the same and do the changes accordingly.

  • PDF to TIFF conversion Tiff File Size problem after conversion

    Hi,
    I am able to convert the PDF file into multi page TIFF file using the below method. But i am getting a size of 1.3 mb for each page of TIFF file (noofpagesX 1.3 mb). it's huge size right? So Could any one please help me out how to decrease the size of the TIFF file? It's an urgent for me. help me out.....
    public static byte[] PDF2TIFF(byte[] bai, String imageType) {
    byte[] out = null;
    try {
    PdfDecoder decoder = new PdfDecoder();
    decoder.openPdfArray(bai);
    decoder.setSize(100, 100);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BufferedImage image[] = new BufferedImage[decoder.getPageCount()];
    TIFFEncodeParam param = new TIFFEncodeParam();
    param.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS);
    param.setLittleEndian(true);
    param.setWriteTiled(false);
    if (decoder.isFileViewable()) {
    for (int i = 0; i < decoder.getPageCount(); i++) {
    int pageNumber = i + 1;
    BufferedImage imageTemp = decoder.getPageAsImage(pageNumber);
    System.out.println("Page Number."+pageNumber);
    image[i] = imageTemp;
    ImageEncoder encoder = com.sun.media.jai.codec.ImageCodec.createImageEncoder("tiff", baos, param);
    Vector vector = new Vector();
    for (int i = 1; i < image.length; i++) {
    vector.add(image);
    param.setExtraImages(vector.iterator());
    encoder.encode(image[0]);
    baos.flush();
    baos.close();
    decoder.closePdfFile();
    out = baos.toByteArray();
    catch (Exception e)
    e.printStackTrace();
    return out;
    Thanks
    Sha                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    For the Batch Sequence that "asks" --
    Something to try.
    Open the Batch Sequence dialog.
    Select the appropriate Batch Sequence.
    Click the Edit button.
    In the Edit Batch Sequence - <name of sequence> dialog, use item number 3's drop-down menu.
    From the menu, select 'Same folder as originals'.
    "OK" out of the dialog.
    Give the Batch Sequence a test run.
    Output ought to be to the same folder as that of the selected & processed files.
    Be well...

  • How to control text for PDF Files in the BI7.0 Broadcaster

    Hi ,
    I am running a web template in the BI7.0 Broadcaster. The output prints in the PDF format. In the precalculation tab I have set up 4 variables(VAR1,VAR2 .. etc) . The main folder where these PDF files get stored I can control the text but dont know how to change the PDF file names which fall into this folder. All the PDF files have the technical name and number(like XXX_00000,XXX_00001 etc.) How can I control the text for these files.
    Thanks,
    Kal

    HI Kal,
    it is not possible to get any influence on the filenames. If you use Filternavigation the filename is generated to be unique.
    best regards,
    kai

  • How to change setting for 'last 5 password change prompt'

    hi friends
    in sap, when a user changes a password sometimes he/she gets a message "Please select a password that is different from last 5".
    now i am in need to change this default value of "5" to "2" but i dont know what is the parameter name for changing this setting.
    i would appreciate if anybody can tell me how to change this setting.
    many thanks
    regards

    Hi nathan drake
    The parameter for password history is   login/password_history_size = 5
    you can change to 2.
    Regards,
    Firoz.

  • How are permissions set for Reader XI Protected Mode?

    Hi, all,
    I've just installed Reader XI, and I immediately ran into an issue with Protected Mode "protecting" me from my workflow.  I'm trying to access a .kml file on my desktop to import some annotations into a Reader Enabled PDF file.  When I get the popup window saying that I don't have permissions to open this file, I head for the Reader security settings.  Adobe kindly provided us with a UI to select files, folders, and hosts to treat as priviledged.  I enter my desktop folder's path using the UI, and save.  I restart Reader, expecting this setting to help.  In fact, the security UI reports that  my desktop folder is priviledged, which is good.  The operation still fails, with the exact same error message.  Is this the anticipated behavior, and if so, what is the privileged file, folder, and host for?  I can't read or write files to my priviledged locations.  Is this correct?
    Thanks
    Joe White

    Does it work if you change the file extension to .xml from .kml?

  • How to select settings for pdf version when combining files

    Hi all, I was wondering if anyone can tell me if there is a way to set the settings of the resultant pdf, like you can do for word and such (see screenshot). I have pdf's that are 1.4 compliant but when i merge them together they become v1.6 compliant. Ideally i'd like ability of right clicking the files and selecting the combine option from the context menu and the resultant file keeping to v1.4.
    Any help would be appreciated thx

    Thanks, we already do this but I would like to set it and forget it... Theres always someone that will forget the extra step

  • Time setting for pdf file presentation

    Can I set different times for different pages of my pdf file when using the whole screen presentation in Adobe Reader? Thanks!

    I'm pretty sure that needs to be done in the creation of the PDF in Acrobat. Best to ask in that forum

  • How do I set for firefox be the only one browser. I want to get rid of AVG, Conduit browser.

    I want to set only Firefox browser in my PC. How do I do that and get rid of AVG, Conduit and 4 shared browsers
    Thanks
    Hash

    I do not wish to remove other browsers eg. Internet Explorer (needed for some Government sites) and Chrome (Quick access to GMail).
    Sorry Firefox but I still do want to remove AVG. on the homepage. I prefer the old Google Page.
    I will have to stop using Firefox if you go on being obstructive about removing AVG.
    Remember ' the customer is always right'.
    Regards
    Naomi MacColl

  • HT4108 Using lightning digital AV adapter on iPad, how to change setting for sound to play on Bluetooth device

    How do you change the sound settings when using the lightning digital AV adapter HDMI to a Bluetooth device.

    Hi Rob - thanks so much for your help!  Could you tell me what "air sever or reflector apps." are? and where can I look for information about them?
    Do you use them on the Ipad or on the PC?
    Do I need a cable too and which one?
    Sorry... I am not very technical as you can see, thanks for your help.
    Regards

  • How to hide OpenOffice for PDF Converter

    Hi ALL,
    I am using OpenOffice.org for converting .doc, .xls, .ppt etc formats to PDF formats using OpenOffice QuickStarter as background process. All the documents are converted successfully but every time this QuickStarter opens-up and clearly seen as process running in. But We want this listener runs hiddenly as backgroud process.
    So is there any changes requires in configuration to hide Quickstarter Listener?
    Please let me know as quickly as possible.
    Thanks in advance
    Regards,
    Vishal Shah

    Hi,
    try
    soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard
    with the appropiate parameters for your installation (port, host, etc...)
    Regards,

Maybe you are looking for

  • HT5621 I want to make the Apple ID on my IPad and ICloud match, how do I do this?

    I cannot use my ipad it continuously requests an ICloud password, I believe 2 ICloud accounts were setup in error. I would like to have the same apple Id for the IPad and Icloud? How do I do this, or how do I correct theconstant request for an ICloud

  • Best file for importing images from Illustrator and Photoshop for small file sizes

    Hello Adode consults! I'm in the process of preparing an inDesign file for a school project -- I've already had a few harrowing experiences sending large files to the printer that are too large to process (and a very grumpy computer, etc). The end re

  • How to debug Stored Procedures on Runtime?

    Is there any way or any tool available using which I could debug stored procedures on runtime ? Please also pass the links if you know any.

  • How can I find out how much data an update takes

    I have only limited access to data, unless I'm paying big overage charges.  Thereforre I want to know before hand how much data i will download with each update.  No information appears to be available when you want to update your pages, numbers or k

  • Using a SubTabBar inside a Template

    Does anyone have a template that contains a SubTabBar? I am using subtablayout/subtabbar in my pages and it works great. However, when I put them in my template, then when using the template in my pages, the page items are rendered outside of the sub