We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Lag when appending PDF Document

Hey,


I just had a lag appending a PDF document to a Word one.
Some numbers in the boxes just move compared to their original positions.

Please just see by yourself the screenshots attached, and the documents I used.

Thanks by advance.
Luc.
Hi Luc,

Thanks for your inquiry. Could you please attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

Hi,


Here’s my test project.
Can you have a look on it?

Plus, I’m having a Startxref not found Exception.

Thanks.
Luc
Hi Luc,

Thanks for your inquiry. Your query is related to Aspose.Pdf APIs. So, I am moving this forum thread to Aspose.Total forum. My colleagues will answer your query shortly.

Ok perfect thank you.


Luc.

Hi Luc,


Please share Documents.7z and Capture.png files again in this forum thread. These files are corrupted (during the transformation of thread) and we can’t open them on our side. We’re sorry for the inconvenience caused. Your response is awaited.

Hi Luc,

Thank you for being patient. We manage to download your source documents.

Your code execution flow converts a PDF to DOCX, and then pass its byte array to the Aspose.Pdf.Document class, since it shows an invalid PDF file format error with additional information as: “Startxref not found”.

We have tested your source documents against the Aspose.Words (version: 17.2.0) and Aspose.PDF (version: 17.2.0) APIs and also simplified your code as below. We’re unable to notice misplaced numbers as shown in your screenshots. We have attached output Word document to this reply for your kind reference.

[.NET, C#]

// Aspose Word Document we are going to use as assembled, file output
Aspose.Words.Document doc = new Aspose.Words.Document(@"C:\AD\test901\Documents\Model_FO.dotx");

// DocumentBuilder used to insert the fields (paragraph, section, …) in the merge doc
Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);
Aspose.Words.Document word = new Aspose.Words.Document(@"C:\AD\test901\Documents\01_communiqué de presse.docx");
//Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(@"C:\AD\test901\Documents\01_Bureau_vote_Neuchatel_FO22.pdf");
Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(@"C:\AD\test901\FO04_06_ACE_DEF_Annexe_Grille_Horaire_SEO_2017.pdf");
Aspose.Pdf.DocSaveOptions saveOptions = new Aspose.Pdf.DocSaveOptions { Format = Aspose.Pdf.DocSaveOptions.DocFormat.DocX };
MemoryStream ms = new MemoryStream();
pdf.Save(ms, saveOptions);
Aspose.Words.Document pdfDocx = new Aspose.Words.Document(ms);

builder.ParagraphFormat.StyleIdentifier = Aspose.Words.StyleIdentifier.Heading1;
builder.Writeln("Titre 1");

InsertNoticeTitle(ref builder, "Titre de mon annonce");
builder.ParagraphFormat.StyleIdentifier = Aspose.Words.StyleIdentifier.Normal;
builder.InsertDocument(word, ImportFormatMode.KeepSourceFormatting);

if (pdfDocx != null)
{
    builder.Document.AppendDocument(pdfDocx, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
}
InsertNoticeReference(ref builder);
InsertLine(ref builder, doc.Document);

doc.Save(@"C:\AD\test901\Final.docx", Aspose.Words.SaveFormat.Docx);