I have to use a 3rd party SDK that generates reports in a System.Drawing.Printing.PrintDocument format. Since my project is not a Windows Form project(it is a Web project),I need to convert this System.Drawing.Printing.PrintDocument to a PDF. I have downloaded iTextSharp and SharpPDF but they seem to create a new PDF. I have also gone through the tutorial(s) here: http://sharppdf.sourceforge.net/Tutorials.html. My requirement is to convert the document that I already have into a PDF. Is there something that I'm missing in using these libraries? Can someone please provide a sample code to achieve this?
Convert System.Drawing.Printing.PrintDocument to PDF c#
19.4k views Asked by user1550951 At
2
There are 2 answers
0
abdulaziz saeed
On
you can create document by print to file in .net
exapmle : convert printDocument to XPS file , try code:
private void button8_Click(object sender, EventArgs e)
{
Addpage = 0;
printDocument1.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
printDocument1.DefaultPageSettings.PrinterSettings.PrintToFile = true;
printDocument1.DefaultPageSettings.PrinterSettings.PrintFileName = "d:\\ddd11.xps";
printDocument1.PrintController = new StandardPrintController();
printDocument1.Print();
}
in future time we will get convert printDucument to pdf file .
thank you
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in PDF-GENERATION
- PDF form checkbox/radio button ignores content stream
- Convert React Components into PDF
- I have a response from an API in the form of a binary file and I need to transform it into a PDF in react.js
- Create PDF from tinyMCE with copy/paste screenshot in it (Laravel)
- Implementing PDF generation and then From Local Notification Open the Pdf that is Saved to Download
- How do I create a website that combines user input and standard text and converts it into a pdf?
- (Flutter/Dart-PDF) How to handle long text in a Multipage Table without causing InstanceOfTooManyPages error?
- PDF form field shows original field value even after focus
- How to loop through list of values to then create PDFs in Python
- How to create pdf with multiple pages based on html using python pdfkit
- How can I resolve "TypeError: Cannot read properties of undefined (reading 'makeCopy')"?
- Itext 7 library replaces text in pdf file, but the selected text is not in the right position
- (spring boot) can't generate pdf using openPdf library
- Facing the DllNotFoundException with SkiaSharp.dll while converting the document as a PDF after using the hosted AWS service path
- Download PDF using any cloud and grant access only to a particular person
Related Questions in ITEXT
- Itext pdf deferred signing with invalid signature
- Itext 7 library replaces text in pdf file, but the selected text is not in the right position
- Pdf signing using USB device
- Posting a filled in pdf form back to server for processing Itext7 .net core
- How to fit long text inside text box using iText Java
- Pdf hash sign with iText v8.0.3
- I want to completely flatten/remove some pdf text/objects outline in the pdf document I am working with using iText or any tools programmatically
- Combining different PDF files onto a single PDF page, creating a sample booklet
- Digitially sign a PDF using java
- How to handle "No StructParents key" PDF syntax issue when using iText to copy pages?
- Creating PDF file with large data by springboot with jasper report
- Itext and Pdfbox Rotation settings compatibility issues
- Unable to make itext5 pdf watermark non removable in VMware Workspace ONE Boxer email
- iText7 deferred signed pdf document shows “Error during signature verification.”
- iText7 TextRenderInfo.GetFontSize() usually produces a false result
Related Questions in PRINTDOCUMENT
- issue with Printing/Export to PDF datagridview c#
- How to print flowDocument to PDF without specifying file name
- C# Print word document page by page to get orientation and create one print spool
- Datacard Printer, using PrintDocument Failed to read default page settings of the printer
- vb.net 2022 PrintDocument in Windows 10 and Windows 11
- C# Print Document Prints Images Fine, But Then Stops Printing Images
- Printing PDF file using PrintDocument but keeeping ActualSize
- Problems with print out a Win Form
- How to print A4 size Page
- How to save PrintDocument (e.Graphic) as PDF in VB.net
- C# StringTrimming.EllipsisCharacter not properly truncating text in PrintDocument
- Saving / Printing a PrintDocument object to a JPEG/ BMP or any image format
- c# system.drawing how to print pdf to whole page size without blurr and losing quality
- PrintDocument with Image VB.net
- Printing nested loops using C# PrintDocument and the PrintPage event
Related Questions in SHARPPDF
- how to printpreview and print SharpPDFLabel in vb.net
- SharpPDF for ASP.net core 2.2.x
- How do you justify a paragraph in sharpPDF?
- addImage not working in SharpPDF
- Unity 3d SharpPdf C# generation and display
- WP SharpPDF NuGet Package
- Unity3d sharpPDF plugin different color of rows and cells
- Encrypt jsPDF generated pdf to SharpPDF
- Migradoc & sharpPDF
- Split into two lines long string in sharppdf
- Convert System.Drawing.Printing.PrintDocument to PDF c#
- I'm trying to use PDFSharp but I can't find predefinedFont.csHelvetica
- Special characters in SharpPDF
- sharpPDF Table Headers using Turkish character error
- SharpPDF create PDF in Serverside asp .Net C#
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
How about installing a virtual PDF printer and "print" the document? For example - http://www.dopdf.com/, or http://www.cutepdf.com/products/cutepdf/writer.asp?
A code sample of how to print a PrintDocument, can be found here http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx
Another possible course would be take the Graphics from the PrintDocument (http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.printpage(v=vs.80).aspx and look at what is proposed here - http://www.websupergoo.com/helppdfnet/source/4-examples/20-systemdrawing.htm