- Home
- Forum
- Xamarin.Forms
- Emulator Xamarin Word to PDF broke the document
Emulator Xamarin Word to PDF broke the document
Hi,
we are still testing the Synfusion DocIO and Xamarin and WPF/Winforms Lib.
We using a xamarin-test-app to implament a dll (.net 2.0 with docio) to create a word document.
In emulator mode when we saving the word document with stream and rendering the pdf document the pdf creates 13 pages instead of 1!
When we installing the to normal (not emulatet) device the app runs perfect.
DataReader dataReader = new DataReader();
PdfCreator pdfCreator = new PdfCreator();
pdfCreator.CreateBMP(dataReader.SimpleData());
string filename = Path.Combine("/storage/emulated/0/Download/", "WPFDatei.docx");
pdfCreator.SaveApp(pdfCreator.MemoryStream, filename); // <- Save the worddocument to the device storage!
FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
WordDocument wordDocument = new WordDocument(fileStream, Syncfusion.DocIO.FormatType.Docx);
DocIORenderer render = new DocIORenderer();
render.Settings.ChartRenderingOptions.ImageFormat = ExportImageFormat.Jpeg;
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
render.Dispose();
wordDocument.Dispose();
MemoryStream outputStream = new MemoryStream();
string Pdffilename = Path.Combine("/storage/emulated/0/Download/", "word.pdf");
pdfDocument.Save(outputStream);
FileStream fileStreamPdf = new FileStream(Pdffilename, FileMode.Create, FileAccess.Write);
outputStream.WriteTo(fileStreamPdf);
fileStreamPdf.Close();
outputStream.Close();
FileStream openPdfStream = new FileStream(Pdffilename,FileMode.Open ,FileAccess.Read);
pdfViewerControl.LoadDocument(openPdfStream);
PdfCreator pdfCreator = new PdfCreator();
pdfCreator.CreateBMP(dataReader.SimpleData());
string filename = Path.Combine("/storage/emulated/0/Download/", "WPFDatei.docx");
pdfCreator.SaveApp(pdfCreator.MemoryStream, filename); // <- Save the worddocument to the device storage!
FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
WordDocument wordDocument = new WordDocument(fileStream, Syncfusion.DocIO.FormatType.Docx);
DocIORenderer render = new DocIORenderer();
render.Settings.ChartRenderingOptions.ImageFormat = ExportImageFormat.Jpeg;
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
render.Dispose();
wordDocument.Dispose();
MemoryStream outputStream = new MemoryStream();
string Pdffilename = Path.Combine("/storage/emulated/0/Download/", "word.pdf");
pdfDocument.Save(outputStream);
FileStream fileStreamPdf = new FileStream(Pdffilename, FileMode.Create, FileAccess.Write);
outputStream.WriteTo(fileStreamPdf);
fileStreamPdf.Close();
outputStream.Close();
FileStream openPdfStream = new FileStream(Pdffilename,FileMode.Open ,FileAccess.Read);
pdfViewerControl.LoadDocument(openPdfStream);
any idea?
The word document is broken to. Both Files has 13 pages but only in emulator mode on VS 2019!
Regards
Christian
SIGN IN To post a reply.
1 Reply
VA
Vijayasurya Anandhan
Syncfusion Team
July 24, 2019 09:19 AM UTC
Hi Christian,
Thank you for contacting Syncfusion support.
On further analysing the shared details, we suspect that the font used in the Word document may be available in the emulator which might cause the issue with “Extra pages are available in the generated PDF in emulator alone”.
To overcome this issue, we request to check whether the font used in the Word document is installed in the emulator, if not so please install the missing font and perform conversion.
If you face difficulties to install the font, we request to use our font substitution feature. Please find the sample from the below link.
https://www.syncfusion.com/downloads/support/forum/146100/ze/WordToPDF-92443992.zip
If you still face issue, we request to share the below details to reproduce the issue in our end which will be helpful for us to proceed further in this.
1. Sample with complete code snippet in which you are facing issue.
2. Input Word document
Please let us know if you have any questions.
Regards,
Vijayasurya A
Thank you for contacting Syncfusion support.
On further analysing the shared details, we suspect that the font used in the Word document may be available in the emulator which might cause the issue with “Extra pages are available in the generated PDF in emulator alone”.
To overcome this issue, we request to check whether the font used in the Word document is installed in the emulator, if not so please install the missing font and perform conversion.
If you face difficulties to install the font, we request to use our font substitution feature. Please find the sample from the below link.
https://www.syncfusion.com/downloads/support/forum/146100/ze/WordToPDF-92443992.zip
If you still face issue, we request to share the below details to reproduce the issue in our end which will be helpful for us to proceed further in this.
1. Sample with complete code snippet in which you are facing issue.
2. Input Word document
Please let us know if you have any questions.
Regards,
Vijayasurya A
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
CS Christian Stutz
- Jul 19, 2019 01:17 PM UTC
- Jul 24, 2019 09:19 AM UTC