TIF to PDF conversion (Java)

Hi There,


1) We have a requirement to convert TIF images to PDF documents, initially we have planned on using Aspose Words for Java to convert but looks like this doesn’t support this conversion. When i tried to convert TIF file it gave an error saying unsupported image type.
2) I have tried to use Aspose PDF kit for Java and still it didn’t work, though it didn’t gave same error but it went on and created PDF file but created PDF file was empty.

PDF/A formats
1) Using Aspose Words converting feature can i convert Word documents as PDF/A documents? Please let me know how i can do that? If its not possible can i achieve with any of your products like Aspose PDF for Java?
2) Can you please let me know is there any support for PDF/A documents in Aspose PDF or Aspose Words?

we are currently looking for only Java based products.

Regards
Srini
Email - srinivasa.kanakam@judiciary.state.nj.us

Hi Srini,

If you want to convert a TIFF (or other images) to a new PDF file, you can do that with the help of Aspose.Pdf for Java by using the following code snippet: Convert Images to PDF. Aspose.Pdf.Kit for Java allows you to add images in an existing PDF file only.

As far as converting a Word document to PDF/A compliant file is concerned, I’m afraid, this is currently not supported. You can only convert a Word document to a PDF document using Aspose.Words for Java. However, we have logged a new feature request to convert an existing PDF file to PDF/A compliant file, for Aspose.Pdf.Kit for Java, as PDFKITJAVA-28640 in our issue tracking system. You’ll be notified via this forum thread once it is supported in future.

We’re sorry for the inconvenience.
Regards,


Hi,

I have used the code snippet to convert TIF image as PDF(Java) it did work fine but I have never been able to show image color as it is because conversion is producing output as black and white, do you know how I can make it color?

Here is the Java code I am using.

License license = new License();
try {
    license.setLicense(new FileInputStream("C:/Projects/ProtoTypes/PDF-Aspose/Aspose.Pdf.lic"));
} catch (Exception e2) {
    e2.printStackTrace();
}

// Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();

// Create a section in the Pdf object
Section sec1 = pdf1.getSections().add();

// Create an image object in the section
Image img1 = new Image(sec1);

// Set the path of image file
img1.getImageInfo().setFile("C:/Projects/ProtoTypes/PDF-Aspose/ccm/conversion/doctopdf/desktop.tif");

// Set the path of image file
//img1.getImageInfo().setTitle(“TIF image”);
img1.getImageInfo().setImageFileType(ImageFileType.Tiff);
//img1.setImageScale(0.95F);
// Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(img1);

// Save the Pdf
FileOutputStream out = null;
try {
    out = new FileOutputStream(new File("C:/Projects/ProtoTypes/PDF-Aspose/ccm/conversion/doctopdf/desktop.pdf"));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
    e1.printStackTrace();
}
pdf1.save(out);

Your documentation shows I can convert Word document "Any document loaded into Aspose.Words can be converted to PDF that conforms to the PDF 1.5 or PDF/A-1b specification." - Can you please explain how i can do this? Converting to PDF/A-1b?

http://www.aspose.com/documentation/java-components/aspose.words-for-java/adobe-portable-document-format-pdf.html

kanakams:

Your documentation shows I can convert Word document "Any document loaded into Aspose.Words can be converted to PDF that conforms to the PDF 1.5 or PDF/A-1b specification." - Can you please explain how i can do this? Converting to PDF/A-1b?

http://www.aspose.com/documentation/java-components/aspose.words-for-java/adobe-portable-document-format-pdf.html

Hi Srinivasa,

Thanks for contacting support. As your query is related to Aspose.Words, so I am moving this thread to respective forum where I believe our team of experts taking care of this product would be in better position to answer this query. Please be patient and spare us little time. We apologize for this inconvenience.
kanakams:
I have used the code snippet to convert TIF image as PDF(Java) it did work fine but i have never been able to show image color as it is because conversion is producing output as black and white, do you know how i can make it color?

Hello Srinivasa,

Can you please share the source Image file so that we can test the scenario at our end. We are sorry for this inconvenience.

Attached an image file i am trying to convert and as well output PDF file using the code snippet i gave you above.

Hello Srinivasa,


I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as
PDFNEWNET-32319. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

Hi Aspose Word team,


Can you please answer following?

Your documentation shows I can convert Word document “Any document loaded into Aspose.Words can be converted to PDF that conforms to the PDF 1.5 or PDF/A-1b specification.” - Can you please explain how i can do this? Converting to PDF/A-1b?

http://www.aspose.com/documentation/java-components/aspose.words-for-java/adobe-portable-document-format-pdf.html

Can you please give me details on how i can convert word document to PDF/A-1b?

Regards

Srini

Hi

Thanks for your request. Here is code that demonstrates how you can save a Word document as PDF/A-1b:

// Open input document.
Document doc = new Document("in.doc");

// Specify PDF compliance.
PdfSaveOptions opt = new PdfSaveOptions();
opt.setCompliance(PdfCompliance.PDF_A_1_B);

// Save document to PDF.
doc.save("out.pdf", opt);

Best regards,

Hi Aspose Team,


We are waiting to purchase Site OEM license and its dependent on converting TIF image to PDF. I have tried to convert using Aspose PDF and it converted to black and white only, when i use Aspose Word it didn’t work at all. Can you please respond with this bug in Aspose PDF. We are looking at only Java products.

Srini
srinivasa.kanakam@judiciary.state.nj.us

Thank you very much i am able to convert to PDF/A-1b.

Hi

It is perfect that you managed to convert your documents. Also please take a look at the following article:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/howto-convert-an-image-to-pdf.html

It describes how you can convert images including TIFF to PDF using Aspose.Words.

Best regards,

I have used same exact piece of code to convert images to PDF but it didn't work for TIF image types.

Unfortunately it didn't recognize TIF as valid format and failed at following line.

ImageReader reader = ImageIO.getImageReaders(iis).next();

As Aspose Words for Java failed i tried to use PDF and it didn't do the job as well. I am attaching TIF file which need to be convered if you can let me know how i can convert it to PDF that would be great help.

Srini

Hi Srini,


I tried converting the TIF image with Aspose.Pdf for Java 3.0.1 and I am unable to notice any issue. The PDF file is being generated but the colors are not being displayed in resultant PDF (issue is already reported). Can you please try using the latest release version of Aspose.Pdf for Java 3.0.1.

[Java]
Pdf pdf = new Pdf();
//add a section
Section sec1 = pdf.getSections().add();
// create an image object
aspose.pdf.Image img1 = new aspose.pdf.Image(sec1);
/ set image
img1.getImageInfo().setFile(“d:/pdftest/desktop (1).tif”);
// specify the image file type
img1.getImageInfo().setImageFileType(ImageFileType.Tiff);
// add image to paragraphs collection of Section object
sec1.getParagraphs().add(img1);
// specify the image height information equal to Section height minus Top and Bottom margin of page
img1.getImageInfo().setFixHeight(sec1.getPageInfo().getPageHeight()- sec1.getPageInfo().getMargin().Top - sec1.getPageInfo().getMargin().Bottom);
// specify the image Width information equal to Section Width minus Left and Right margin of page
img1.getImageInfo().setFixWidth(sec1.getPageInfo().getPageWidth()- sec1.getPageInfo().getMargin().Left- sec1.getPageInfo().getMargin().Right);
// save the pdf file
pdf.save(“d:/pdftest/TIFF-ImageConversion.pdf”);

Thank you for quick response.

Yes, i am able to convert TIF to PDF as well using Aspose PDF for Java. Like it happend to you i also got the output which is black and white.

If this is going to be a bug and will be fixed do you know does it take 3 months or 6 months because we need this feature to work for us but we need timeline on when this will be fixed.

Regards

Srini

Hello Srini,


Our development team is working hard to resolve the problem regarding black image inside PDF file but I am afraid its not yet fixed. Nevertheless, I have requested the development team to share the ETA regarding its resolution. Please be patient and spare us little time. We are really sorry for your inconvenience.

Hi Srini,

Thanks for your inquiry.

Additionally the reason Aspose.Words was encountering that exception is because you must have the appropriate JAI reader installed to load the TIFF image format. You can download and install the latest version from here: http://java.net/projects/jai-imageio/

Thanks,

Hi Aspose Team,

Thank you very much for response, i am able to convert TIF to PDF using Aspose Word by including Java Image IO package.

Regards

Srini

Hi Srini,


Thanks for your patience.

I have further discussed the resolution of PDFKITJAVA-28640 and I am afraid we might not be able to support this feature in current release version of Aspose.Pdf.Kit for Java. Currently we are only resolving Priority issues in Aspose.Pdf.Kit for Java and we do not plan to introduce any new features in this product. However we are planning to roll out a Merged release version of Aspose.Pdf for Java and Aspose.Pdf.Kit for Java which will include all the features of both products.

Please be notified that we have a venture named CodePorting which provides the capability to convert .NET code to Java platform and we are in the process of porting the current Aspose.Pdf for .NET code base to Java format to introduce a merged version of Aspose.Pdf for Java. Please note that the current version of Aspose.Pdf for .NET supports the feature to convert PDF file to PDF/A format and once the new version of Aspose.Pdf for Java will become available, it will support the feature of converting PDF files to PDF/A. Nevertheless, the current plan to release merged version of Aspose.Pdf for Java is planned for November-2012.

As soon as we have some updates, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. We are sorry for your inconvenience.