Dear Aspose Team,
I have issue in converting from doc\docx to pdf .
Issue 1:
The input contains images and it converts the PDF file but during the conversion image DPI value is changed. How to solve the issue?
eg,
input Doc file image DPI value is :600 (horizontal resolution)
output pdf file image DPI value is : 299 (horizontal resolution)
Attached a sample input and actual output
Issue 1: Samples DPI Issue.zip (4.6 MB)
I have converted your DOCX to PDF format by using MS Word 2019 and Aspose.Words for .NET 19.8 versions and attached both the output PDF files here for your reference:
On what page in 19.8.pdf, the image has this problem? What steps did you perform to verify that the image in Aspose.Words generated PDF file has different DPI?
Also, I had used the following simple code to produce 19.8.pdf on my end.
Document doc = new Document(@"E:\DPI Issue\Input file.docx");
doc.Save(@"E:\DPI Issue\19.8.pdf");
Dear @awais.hafeez
i use some code to verify the dpi value
String dataDir=“C:\Users\0015947\Desktop\Sample\DPI\Aspose output.pdf”;
// Open document
Document document = new Document(dataDir);
// Create ImagePlacementAbsorber object to perform image placement search
ImagePlacementAbsorber abs = new ImagePlacementAbsorber();
// Accept the absorber for first page
document.getPages().accept(abs);
// Display image placement properties for all placements
for (Object imagePlacement : abs.getImagePlacements())
{
ImagePlacement placement = (ImagePlacement) imagePlacement;
System.out.println("image width:" + placement.getRectangle().getWidth());
System.out.println("image height:" + placement.getRectangle().getHeight());
System.out.println("image horizontal resolution:" + placement.getResolution().getX());
System.out.println("image vertical resolution:" + placement.getResolution().getY());
}
Dear @awais.hafeez
the input file contains 3 images (dpi value is 600,300,600) .
after the conversion the pdf file contain 3 images but the dpi value is not same to the original source(doc file)
We have logged your problem in our issue tracking system. Your ticket number is WORDSNET-19057. We will further look into the details of this problem and will keep you updated on the status of the linked issue. We apologize for your inconvenience.
Regarding WORDSNET-19057, by default Aspose.Words down-samples the images to 220 ppi resolution. It could be controlled by PdfSaveOptions.DownsampleOptions. To keep the images as is, you can disable down sampling with DownsampleOptions.DownsampleImages flag.
P.S. There may be misunderstanding. By down sampling resolution Aspose.Words means the ratio of the image size in pixel to the image size on document the page in inches. But by the DPI resolution you may mean the value stored in the image file. Aspose.Words tries to preserve the resolution value from the source image but it is not always possible due to PDF format peculiarity.
Please check my previous message for analysis details and if there will be no other questions from your end then we will close this issue (WORDSNET-19057) as ‘Not a Bug’.
I am afraid, we do not see the DPI difference. Aspose.PDF returns the same values as in original images: 220 (despite your claim it is 600 the actual value in file is 220), 300 and 600. Please let us know if we can be of any further assistance.
Dear @awais.hafeez
Please check the below file with dpi 600 . The converted pdf do not gives the original dpi value.
Attached samples for your references,
Sample: DPI ERROR.zip (5.9 MB)
We have converted your ‘input.docx’ document to PDF format by using the following Aspose.Words for Java code and attached the output PDF here for your reference: awjava-19.8.pdf (791.3 KB)
Document doc = new Document("E:\\Temp\\DPI Issue\\Input file.docx");
doc.save("E:\\Temp\\DPI Issue\\awjava-19.8.pdf");
Also, the ‘Actual Output.pdf’ was generated by using Aspose.PDF for Java 19.6 API. It may be because of that you are processing/saving PDF file with Aspose.PDF for Java.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.