Hi Team,
After converting to docx to searchable pdf. The data from the right margin is truncating in output.pdf.
Seems like doc is A5 page or A3 paper size. But Aspose.OCR 24.11.3 is treating it as an A4 document.
How can we fix this issue
// Load the DOCX file
Document doc = new Document("PrintLayoutIssueFile.docx");
PdfSaveOptions pdfSaveOptions = new()
{
ZoomFactor = 100,
ZoomBehavior = PdfZoomBehavior.FitPage,
SaveFormat = AsposeWords.SaveFormat.Pdf,
ColorMode = ColorMode.Normal,
FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
EmbedFullFonts = false,
Compliance = PdfCompliance.PdfUa1,
ImageCompression = PdfImageCompression.Jpeg,
TextCompression = PdfTextCompression.Flate,
MemoryOptimization = true,
JpegQuality = 100,
PageMode = PdfPageMode.FullScreen,
UseHighQualityRendering = true,
OptimizeOutput = true,
HeaderFooterBookmarksExportMode = HeaderFooterBookmarksExportMode.All,
DisplayDocTitle = true,
ExportDocumentStructure = true,
UseCoreFonts = true,
DownsampleOptions = DSOResolution,
PreserveFormFields = false
};
// Save the DOCX file as a PDF
doc.Save("output.pdf",pdfSaveOptions );
// Initialize Aspose.OCR
AsposeOcr ocrEngine = new AsposeOcr();
// Perform OCR on the PDF to make it searchable
using (FileStream pdfStream = new FileStream("output.pdf", FileMode.Open))
{
OcrInput input = new OcrInput(InputType.PDF);
input.Add(pdfStream);
// Recognize the text from the PDF
OcrResult result = ocrEngine.Recognize(input);
// Save the searchable PDF
result.Save("searchable_output.pdf", SaveFormat.Pdf);
}
}