We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

I am losing (all ?!) formats when sending a syncfusion byte array to an network printer(e.g. after printing that array the document has lost his font):

Thread ID:

Created:

Updated:

Platform:

Replies:

130574 May 18,2017 03:40 PM UTC May 30,2017 06:53 AM UTC ASP.NET MVC 5
loading
Tags: PdfViewer
Kevin
Asked On May 18, 2017 03:51 PM UTC

Hi,I am losing formats when sending a syncfusion byte array to an network printer(e.g. the byte array has lost his font): Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.NoDelay = true; IPAddress ip = IPAddress.Parse(ip); IPEndPoint ipEndPoint = new IPEndPoint(ip, someport); socket.Connect(ipEndPoint); socket.Send(_temp); socket.Close();Syncfusion Stuff:... myfunc(){WordDocument word = new WordDocument();//... some code word.Save(myMemoryStream, FormatType.Docx);_temp= myMemoryStream.ToArray();word.Close();} How to solve this problem ?!Thanks

Kevin
Replied On May 18, 2017 04:05 PM UTC

Hi,I am losing formats when sending a syncfusion byte array to an network printer(e.g. the byte array has lost his font): Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.NoDelay = true; IPAddress ip = IPAddress.Parse(ip); IPEndPoint ipEndPoint = new IPEndPoint(ip, someport); socket.Connect(ipEndPoint); socket.Send(_temp); socket.Close();Syncfusion Stuff:... myfunc(){WordDocument word = new WordDocument();//... some code word.Save(myMemoryStream, FormatType.Docx);_temp= myMemoryStream.ToArray();word.Close();} How to solve this problem ?!Thanks

May be this helps too, when providing that byte array to an user agent(FileContentResult File(byte[] fileContents, string contentType, string fileDownloadName);)using asp.net mvc) we need to add the contentType like this for getting the right document for the client: "application/pdf" ,excel: "application/vnd.openxmlformats-officedocument.spreadsheetml‌​.sheet", word: "application/vnd.openxmlformats-officedocument.wordprocessin‌​gml.document" .

Sethumanikkam Yogendran [Syncfusion]
Replied On May 19, 2017 01:14 PM UTC

Hi Kevin,

Thank you for contacting Syncfusion support.

We are unable to reproduce the reported issue with the given details. We suspect that, you might not be installed the fonts (which are used in the Word document) in your production environment. If so, kindly install all the used fonts in your production environment to resolve the reported issue.

If you’re still facing the same issue means, kindly provide us your confirmation details on the below which will be helpful to provide you the appropriate solution at the earliest.

     1. If Loading existing Word document (with or without further modifications in the input document):
          a. If you’re loading any input Word document using Essential DocIO, please try the below code to open Word document directly using FileStream and send a byte array to network printer.
 
// Open Word document using FileStream.
FileStream fileStream = new FileStream("input.docx", FileMode.Open);
// Copy file stream to MemoryStream.
MemoryStream memoryStream = new MemoryStream();
fileStream.CopyTo(memoryStream);
// Gets byte array from memory stream of file.
byte[] temp = memoryStream.ToArray();
 

          b. If you’re facing the same issue means, then the used fonts in the input document might not be installed in your production environment so, install all the used fonts to resolve the issue.
          c. If you’re not facing the reported issue in this approach, then kindly provide us simple sample or code snippet along with input and resultant Word document from your end to reproduce the issue at our end.

     2. If Creating Word document from scratch level:

          As mentioned above, if the issue is reproduced after installing all the used fonts in your production environment, then kindly provide us a sample with fonts used and resultant document generated at your end which will be helpful to analyze further and update you the appropriate details at the earliest.

Please let us know if you have any other questions.

Regards,
Sethumanikkam.Y


Kevin
Replied On May 22, 2017 11:08 AM UTC

Hi,

I the problem here was, that the printer does not support fonts, when sending data over TCP/IP.

Can you provide me an example, to convert an pdf file to images(byte array)?

Something like this:

List<byte[]> PdfToImage(some PdfFile)

Kevin
Replied On May 22, 2017 01:34 PM UTC

using this, will result in printing the raw byte-array(printable and non-printable characters),instead of printing a normal pdf page:
List<byte[]> convert(byte[] pdf){
    PdfLoadedDocument loadedDocument = new PdfLoadedDocument(pdf);
            PdfLoadedPageCollection loadedPages = loadedDocument.Pages;
            Bitmap bitmapImage;
            PdfImage image;

            List<byte[]> ergebnis = new List<byte[]>();

            using (MemoryStream memoryStream = new MemoryStream())
            {
                for (int i = 0; i < loadedPages.Count; i++)
                {
                    bitmapImage = loadedDocument.ExportAsImage(i);
                    bitmapImage.Save(memoryStream, ImageFormat.Png);
                    ergebnis.Add(memoryStream.ToArray());//schreibe das Byte-Array
                }
            }

            return ergebnis;

What is the problem here ?

Akshaya Arivoli [Syncfusion]
Replied On May 23, 2017 07:20 AM UTC

Hi Kevin, 
 
We regret to let you know that we were unable to reproduce the reported issue with the provided details. However, based on the provided details we suspect that your requirement can be achieved by Silent Printing the PDF document using the Syncfusion.PdfViewer.Windows assembly (without exporting the PDF document into image). We have created the sample for your reference and shared the same in the following location. 
 
 
Please try the above sample and revert us with more details about your requirement or the modified sample, if your requirement is differs from the provided sample. Also, share us PDF document in which the issue could be reproduced. These details will be helpful for us to investigate more on your requirement and assist you better. 
 
Regards, 
Akshaya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;