Hi Evgeniy,
Thanks for your quick reply. It is appreciated.
Please note that the latest version we can run is Asose.Images 21.12 from 2021.
We have been experimenting a bit with the code to set the requirements.
We managed to set the original page width and breadth like this:
pdfOpt.setUseOriginalImageSize(true);
The PDF is unfortunately completely unreadable if we add this line for compression (same with Ccitt3 but jpeg works):
setCompression(PdfImageCompressionOptions.Ccitt4);
Do you know if there is a parameter or something we can use to fix this? Or if there is another way?
We tried to change to black & white but it didn’t work.The output tiff still shows colour mode in the settings in Paint.
How should we set the colour to black & white?
And how should we set the resolution to 300 dpi?
Here is the current code we are testing with.
package com.tietoevry.fls;
import com.aspose.imaging.Image;
import com.aspose.imaging.License;
import com.aspose.imaging.fileformats.pdf.PdfCoreOptions;
import com.aspose.imaging.fileformats.pdf.PdfDocumentInfo;
import com.aspose.imaging.imageoptions.PdfOptions;
import com.aspose.imaging.imageoptions.TiffOptions;
;
public class AsposeImage2 {
public static void main(String[] args) {
try {
License imgLicense = new License();
imgLicense.setLicense(“C:\Development\CTS jar files\21.4\Aspose.Total.Java.lic”);
Image image = Image.load("C:\\Development\\FLS\\09009e5e8c08682b.dwg.tif");
TiffOptions cp = (TiffOptions)image.getOriginalOptions();
System.out.println(cp.getCompression());
cp.setBitsPerSample(new int[]{1});
image.save("C:\\\\Development\\\\FLS\\\\09009e5e8c08682b-copy.dwg.tif", cp);
PdfOptions pdfOpt = new PdfOptions();
PdfCoreOptions coreOpt = new PdfCoreOptions();
PdfDocumentInfo pdfInfo = new PdfDocumentInfo();
pdfInfo.setAuthor("TietoEvry Norway");
pdfOpt.setUseOriginalImageSize(true);
// pdfOpt.setPalette(null);
// coreOpt.setPdfCompliance(0);
// coreOpt.setCompression(PdfImageCompressionOptions.Ccitt4);
// pdfOpt.setResolutionSettings(null);
// ResolutionSetting rs = new ResolutionSetting();
// rs.
pdfOpt.setPdfCoreOptions(coreOpt);
pdfOpt.setPdfDocumentInfo(pdfInfo);
image.save(“C:\\Development\\FLS\\09009e5e8c08682b.dwg.pdf”, pdfOpt);
} catch (Throwable e) {
e.printStackTrace();
}
}
}