PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Sep 24, 2018 7:17 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Jan 28, 2016 10:10 pm 
Offline

Joined: Thu Jan 28, 2016 8:28 pm
Posts: 3
I have a solution that uses XpsDocumentWriter to save my report's FixDocument to a xps file and then uses PDFSharp to convert the xsp file to a PDF file. I have another console application that uses PrintServer and PrintQueue to send the bytes of the saved PDF file to a selected printer. The PDF file can be printed on a network RICOH printer, but cannot be printed on a local printer like Lexmark C544 XL, Lexmark E350D or Canon LBP6000/LBP6018. All contents except the bitmap on the PDF file are not printed. I tried a PDF file that was generated by Adobe and it can be printed on the same local printer via my console application. If I open the PDFSharp generated PDF file and manually send it to the local printers, the local printers can print all contents without any problem. Does anybody have any idea about the PDFSharp generated PDF file printing issue? Thanks!

Here is the main program in the console application.
Code:
class Program
    {
        static void Main(string[] args)
        {
            string printServerName = string.Empty;
            string jobQueueName = string.Empty;
            PrintServer printServer = null;
            PrintQueue pq;

            PrintSystemJobInfo jobInfo;

            if (args[0] != "LP") // network printer
            {
                printServerName = @"\\svuschaprint";
                jobQueueName = @"LPUSCHA521C";
                printServer = new PrintServer(printServerName);
            }
            else // local printer
            {
                printServer = new PrintServer();
                jobQueueName = @"Lexmark C544 XL";
            }

            pq = new PrintQueue(printServer, jobQueueName);
            // SIQ Report Package.pdf is generated by Adobe.
            // report_20160121161851854.pdf is generated from a xps file by PDFSharp.
            Byte[] myByteBuffer = File.ReadAllBytes(@"C:\TEMP\Patient Chartable Report - 20160128_165056.pdf");//SIQ Report Package.pdf");
            jobInfo = pq.AddJob(@"Print Screen Report");
            using (MemoryStream ms = new MemoryStream(myByteBuffer))
            {
                ms.CopyTo(jobInfo.JobStream);
                jobInfo.JobStream.Close();
            }

            printServer.Commit();
        }
    }
}


Here is the PDF file generated by PDFSharp.
http://1drv.ms/1PFK7Ft

Here is the PDF file generated by Adobe.
http://1drv.ms/1PFKgbL


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group