PDFSharp | NET Standard 2.0 library | Document Editor library

 by   Didstopia C# Version: v1.0.0-beta8 License: MIT

kandi X-RAY | PDFSharp Summary

kandi X-RAY | PDFSharp Summary

PDFSharp is a C# library typically used in Editor, Document Editor applications. PDFSharp has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A .NET Standard 2.0 library for reading, writing and editing PDF files. DISCLAIMER: This is a modified fork based on several OSS projects. For more information see Licenses or LICENSE.md.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PDFSharp has a low active ecosystem.
              It has 50 star(s) with 16 fork(s). There are 6 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 3 open issues and 9 have been closed. On average issues are closed in 87 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of PDFSharp is v1.0.0-beta8

            kandi-Quality Quality

              PDFSharp has 0 bugs and 0 code smells.

            kandi-Security Security

              PDFSharp has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              PDFSharp code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              PDFSharp is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              PDFSharp releases are available to install and integrate.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PDFSharp
            Get all kandi verified functions for this library.

            PDFSharp Key Features

            No Key Features are available at this moment for PDFSharp.

            PDFSharp Examples and Code Snippets

            No Code Snippets are available at this moment for PDFSharp.

            Community Discussions

            QUESTION

            Converting XAML to PDF and Paginating it for a Xamarin.Forms UWP Project
            Asked 2021-Jun-01 at 19:51

            Until recently I have been stuck on how to achieve the goal of "exporting" a report from a StackLayout into a PDF in a project I somehow pulled out of Dev Limbo.

            --BackStory--

            Previously I have tried to continue the use of the already placed (in the project) PDFSharp package to convert the data presented in the XAML to a PDF for a client. Long story short, I was unable to get PDFSharp to do what I needed it to do and turned to Syncfusion. They seemed to have the features I needed to make this happen. Going based off the code samples they had, I was able to get close to my goal, but not quite. They have the capture portion and they have the pagination portion, but not a combination of the two. I essentially needed to paginate the screenshot that CaptureAsync() saves to make a pdf of the entire report.

            ...

            ANSWER

            Answered 2021-Jun-01 at 19:51

            --How was this resolved?--

            After doing some digging, I came across an answer in this article (I am forever grateful) and forged a solution using it.

            Here's a sample of my XAML content page for context:

            Source https://stackoverflow.com/questions/67795074

            QUESTION

            Enable UTF-8 or set custom font with TheArtOfDev's HtmlRenderer.PdfSharp
            Asked 2021-Apr-12 at 01:19

            I'm using TheArtOfDev's HtmlRenderer.PdfSharp to convert an HTML string to PDF in a ASP.NET web application. The HTML contains Japanese characters. The Japanese symbols are converted to ☐ ascii characters.

            How can I enable UTF-8 or use a custom Japanese font? I tried the following without results:

            • Adding to the HTML string.
            • Adding to the HTML string and then settings the font style on the element with Japanese text.
            • Try a CSS file with @font-face and calling TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.ParseStyleSheet
            ...

            ANSWER

            Answered 2021-Jan-26 at 04:23

            I gave up on HTMLRenderer and PDFSharp and solved all my issues with TuesPechkin, a wrapper for wkhtmltopdf.

            Source https://stackoverflow.com/questions/65856551

            QUESTION

            when filling a pdf document with pdfsharp, the filled form doesn't show the values unless the fields are clicked on
            Asked 2021-Feb-16 at 15:24

            When filling a pdf document with pdfsharp (pdfsharpcore), the filled form doesn't show the values in the acrobat reader unless the fields are clicked on.

            ...

            ANSWER

            Answered 2021-Feb-16 at 15:24

            In order to make the values visible, I've inserted.

            Source https://stackoverflow.com/questions/66227256

            QUESTION

            Convert ByteArray of Office document to ByteArray of PDF in C#
            Asked 2021-Feb-16 at 12:10

            How can I convert a byte[] of an Office document (.doc, .docx, .xlsx, .pptx) to a byte[] of a PDF document assuming Office is installed and Microsoft.Office.Interop is used?

            I fetch the files' byteArray from the database as well as their name. I would like to first convert each file to a PDF and then combine all of the PDFs to one single PDF using PDFSharp (this part is already implemented).

            Code:

            ...

            ANSWER

            Answered 2021-Feb-16 at 12:10

            If you check the documentation for Documents.Open there is no mentioning of opening a document directly from a stream. This is unfortunately an all to common problem in libraries. But there might be other libraries you could use that allow this.

            I would not expect saving to a file to be a major performance issue since the conversion will probably be the dominating factor. But it might cause permission issues if your program is running in a very restrictive environment.

            If you are keeping the file save method you should add some exception handling to ensure the temporary files are deleted even if an exception occurs. I have also seen issues where external programs release the file locks after some time, so it might be useful to try to delete the file multiple times.

            Source https://stackoverflow.com/questions/66222533

            QUESTION

            PdfSharp degrading the quality of my jpg input image
            Asked 2021-Feb-13 at 12:38

            I want to convert a jpg to a pdf. After some research, I found that you can do this using PdfSharp, and since I'm using C# .Net 5.0, I Nugot PdfSharpCore 1.2.11.

            After some research I come up with the following code:

            ...

            ANSWER

            Answered 2021-Feb-13 at 12:38

            XImage.FromFile(inputFilePath) specifies the default quality level of 75.

            If instead you call ImageSource.FromFile (passing in the quality level) then XImage.FromImageSource then you can increase the quality level.

            The image is unlikely to look exactly the same - but bumping it up to 85 or 90 will likely improve its rendering.

            Source https://stackoverflow.com/questions/66183814

            QUESTION

            Printing PDF in ASP.net core 3.1 Razor Pages
            Asked 2021-Jan-25 at 09:26

            In my quest to learn ASP.net core I've created a simple CRUD application using asp.net core 3.1. I want to print my Details page as a Invoice. I have looked around and it seems like printing PDF in full .Net Framework was more available.

            Can anyone point me in the right direction? I have come across free libraries like SelectPDF, WKHTMLTOPDF, PDFSharp but quiet frankly the samples are pre- asp.net core and cannot quiet integrate it with asp.net core Razor Pages. Actually, if I'm not mistaken some of the libraries mentioned above are not compatible with Razor Pages Core.

            ...

            ANSWER

            Answered 2021-Jan-25 at 08:36

            I have come across free libraries like SelectPDF, WKHTMLTOPDF, PDFSharp but quiet frankly the samples are pre- asp.net core and cannot quiet integrate it with asp.net core Razor Pages.

            I suggest that you could use client side library.Because what you metioned are all server side libraries,they all need to find the view and convert to string.As far as I known,it seems no such direct method to convert razor pages to string.So I suggest that you could use jsPDF library.

            Here is a whole working demo:

            Source https://stackoverflow.com/questions/65876743

            QUESTION

            Filling PDF Fields with values in ASP.NET MVC 5
            Asked 2021-Jan-18 at 10:42

            I want to fill an existing PDF file in my web application (developed in ASP.NET MVC 5). The PDF file has a field named "Text1". In this field I want to write the value "abc". I am currently trying to use PdfSharp for this purpose.

            This is how I am currently trying to set a value in a field in the PDF:

            ...

            ANSWER

            Answered 2021-Jan-16 at 07:01

            You have to use PdfString from PDFSharp library like this document.AcroForm.Elements.SetValue("/FieldName", new PdfString("yourstring"));

            You also need this if you are attempting to populate PDF form fields, you also need to set the NeedsAppearances element to true. Otherwise, the PDF will "hide" the values on the form.

            Source https://stackoverflow.com/questions/65726387

            QUESTION

            Consume all source code (non-compiled) from one project into another (PDFSharp)
            Asked 2021-Jan-12 at 21:38

            As the title says, I want to consume all of PDFSharp's source code into my own project. But let me explain why I came to this scenario, so if there is something else I can do, maybe there are other options.

            Goal: Compile my project into a single .exe file to use. No installers. Problem: It uses PDFSharp.dll which is causing me issues.

            What I am trying to do, is use ILMerge to create the .exe. I've used this successfully in the past for other projects.

            The issue I think is that ILMerge is requiring references to other assemblies that PDFSharp uses. The first being Microsoft.ApplicationInsights. So to by-pass this, I installed Microsoft.ApplicationInsights into my project via Nuget. Then removed the actual reference from the project, but referenced the library in my ILMerge command as below:

            ...

            ANSWER

            Answered 2021-Jan-12 at 21:38

            I have this working now, so I just wanted to place my results here since it is already posted.

            My initial problem was that I mistakenly thought the PDFSharp.dll was causing the issue, but it was actually another group of 3rd Party dlls I was referencing.

            I tried for hours to get iLMerge to work with the only success being it would kick out a single .exe file but it would have runtime errors.

            Errors that I encountered:

            Error: Unresolved assembly reference not allowed: Custom.Assembly.

            Solution: Reference the assembly if possible. If you have many, you can reference a folder with the /lib:"C:\folderpath" switch.

            Error: Unresolved assembly reference not allowed: ADotNetFramework.dll.

            Solution: You can reference the desired .Net Framework path where iLMerge will search for missing references. Example: /targetplatform:"v4,C:.NETFramework\v4.8"

            Error: The assembly 'xyz.dll' was not merged in correctly. It is still listed as an external reference in the target assembly.

            Solution: You can get past this error with the /closed switch. However, I don't think I should even have gotten this error because 'xyz.dll' was a referenced dll to be combined.

            Also - use the /log switch, it is extremely helpful in seeing exactly what iLMerge is doing and figuring out your issue. Example: /log:mylog.txt

            This allowed me to see that iLMerge was finding duplicate namespaces, in the 3rd Party assemblies and automatically renaming them. Here is an example from my log:

            Merging assembly 'My.Assembly.Name' into target assembly. Duplicate type name: modifying name of the type '<>f__AnonymousType02' (from assembly 'My.Assembly.Name') to 'My.Assembly.Name.<>f__AnonymousType02' Duplicate type name: modifying name of the type '<>f__AnonymousType12' (from assembly 'My.Assembly.Name') to 'My.Assembly.Name.<>f__AnonymousType12' Duplicate type name: modifying name of the type '' (from assembly 'My.Assembly.Name') to 'My.Assembly.Name.

            Finally - the solution that I found was not to use iLMerge. I found this Answer: https://stackoverflow.com/a/40786196/2596309 which used Costura.Fody I installed the nuget package with:

            Source https://stackoverflow.com/questions/65671458

            QUESTION

            How to add DocumentLink to existing PDF file using PdfSharp
            Asked 2021-Jan-07 at 07:54

            I have several pdf files. and I want to combine all of them in one which I can do using PDFSharp.

            But I also want Table Of Contents at the top with DocumentLink.

            Table of content is separately created using Migradoc which looks as below.

            My question is is there any way in pdfsharp using which I can add Document link on the Document name like Document1, Document2 which redirects to respective pages.

            ...

            ANSWER

            Answered 2021-Jan-07 at 07:54

            Mixing MigraDoc and PDFsharp you can get it done.

            You can add a Tag to the paragraphs that you want to link. While the created PDF and the MigraDoc document are still open, you can combine the PDFs and add the links. In PDFsharp you specify the rectangle you want to turn into a link. If you want a special look for the links, you have to set the look in MigraDoc already.

            Finding the tagged paragraphs in the document to add the links is tricky and I don't have a sample at hand.
            Here is code that adds the pages one by one: https://forum.pdfsharp.net/viewtopic.php?f=8&t=3172
            Add the links after adding each MigraDoc page with the table of contents. See this post on the PDFsharp forum to get started:
            https://forum.pdfsharp.net/viewtopic.php?p=9694#p9694

            Source https://stackoverflow.com/questions/65607056

            QUESTION

            Add an external PDF page to PDFSharp/MigraDoc
            Asked 2020-Dec-17 at 12:21

            I currently build a PDF file with MigraDoc, I then render the document which creates a PdfDocument (PDFSharp) so I can ad external pages from other PDFs (because from my understanding MigraDoc does no have the "notion" of pages and thus cannot add external pages)

            My current PDF file format is:

            ...

            ANSWER

            Answered 2020-Dec-17 at 12:21

            MigraDoc can add pages from PDF files using AddImage. You pass the desired page number (zero-based) after the filename - "test.pdf#5" will take the fifth page from that PDF file.

            You can simply add a page break to a section, add the image, then add another page break. Images can be positioned at absolute positions, so they fill the whole page.

            Automatic page breaks are added when rendering a document to PDF, but you can always add manual page breaks as needed.

            If you use that approach then all pages will be created by MigraDoc and page numbers will work.

            Source https://stackoverflow.com/questions/65089839

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PDFSharp

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/Didstopia/PDFSharp.git

          • CLI

            gh repo clone Didstopia/PDFSharp

          • sshUrl

            git@github.com:Didstopia/PDFSharp.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link