Put an Aspose.Words.Document into an Aspose.PDF.pdf

Hi,
Is it possible to do it and how?
Thank you
Yohann

Hi,

Thank you for considering Aspose.

  1. You can convert any Word document to Pdf. Please refer to:
  1. If you want to Add Word Document to an existing Pdf File. Then for this you should follow two steps:

a) Convert theWord document to Pdf as mentioned in Point 1.

b) Concatenate the Pdf made after converting from Word Document with the existing Pdf. Please refer to:

If you need more help, please do let us know.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Thanks for your answer.
My last insctruction :

pdf.Save(“MyDocument.pdf”);

doesn’t work. It products a PDF file of 0 octet.

Hi,

Please explain in detail what you are doing then we can help you out. Are you converting Word to Pdf? If yes then what code you have write and if you can send me your sample documents, then I can understand your problem.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

It works!!!
But is it normal that it takes 1 min to product the pdf file (the file produced : 119Ko)
The instruction is : pdf.Save(“myDocument.pdf”);
Thanks

Hi,

Please add the following two lines before Save() function.

pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = Path.GetTempPath();

Hope it will speed up the conversion.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,
It works but I delete the line :
pdf.IsImagesInXmlDeleteNeeded = true;
Now it takes just 1 or 2 seconds :slight_smile: It’s great.
Now I want to print this PDF file, I made this but it doesn’t work and I don’t know why :
-------------------------------------------------------------------------------------------------------
this.innerDocumentBuilder.Document.Save(myDocument.xml, SaveFormat.AsposePdf);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(
myDocument.xml, null);

pdf.IsImagesInXmlDeleteNeeded = true;
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath();
pdf.Save(
myDocument.pdf);

Aspose.Pdf.Kit.PdfViewer printHelp = new Aspose.Pdf.Kit.PdfViewer();
printHelp.OpenPdfFile(
myDocument.pdf);
printHelp.PrintDocument();
printHelp.ClosePdfFile();

-------------------------------------------------------------------------------------------------------
Thank you
Yohann

Hi,

Aspose.Pdf cann’t print PDF files. To print your documents Aspose.Pdf.Kit will be used. Please refer to:

[C#]

Aspose.Pdf.Kit.PdfViewer viewer = new Aspose.Pdf.Kit.Viewer();
//Open a Pdf file
viewer.OpenPdfFile("ToPrint.pdf");
//Print the Pdf document using default printer
viewer.PrintDocument();
//Close the current Pdf file
viewer.ClosePdfFile();

If you need more help, please do let us know.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

I tried like that and it works (the print). But there is 2 big problems!
1. The openPdfFile take 5 minutes.
2. The document printed has not the size of a normal page.
I attach the pdf file and I let you try please.
Yohann

Hi,

I have checked with the same code and found no errors. Please explain what problem exactly you are having? The PrintDocument() function sends the Pdf File to the Default Printer Installed in the system. If you want to send the print to the specified printer then call the PrintDocumentWithSettings function. If you still find problems, then send your sample documents and let us check it.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Me this is the OpenPdfFile. It takes 5 minutes to open the pdf document wich is on my desktop.
I don’t know what to do.

Hi,

I have reproduce the error of the image not displaying correctly with the document you send. But about the timing issue, it is taking not more than 6sec on my system. I will discuss this issue with the developers and we will let you know as soon as solution is found.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

I just download the last version of Aspose.Pdf and Aspose.Pdf.Kit and my code is :

this.innerDocumentBuilder.Document.Save(@“C:\Documents and Settings\Rodacom\Bureau\truc.xml”, SaveFormat.AsposePdf);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(@“C:\Documents and Settings\Rodacom\Bureau\truc.xml”, null);

pdf.IsImagesInXmlDeleteNeeded = true;
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath();
pdf.Save(@“C:\Documents and Settings\Rodacom\Bureau\truc.pdf”);

Aspose.Pdf.Kit.PdfViewer printHelp = new Aspose.Pdf.Kit.PdfViewer();
printHelp.OpenPdfFile(@“C:\Documents and Settings\Rodacom\Bureau\truc.pdf”); //this one takes 5 minutes
printHelp.PrintDocumentWithSetup();
printHelp.ClosePdfFile();

During this period of 5 minutes, it takes the 100% of the UC :frowning:
And you when you try with my code, it takes 6 seconds?
You don’t know where is it coming from(the 5 minutes) ?
Thank you
Yohann

Hi,

I wonder why it is not taking much time on my PC. Our developers will check it and let you know.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Try to open it in DEBUG mode (F5).
It takes a long time whereas with Ctrl+F5 it’s fast.
It’s weird.