pdfsharp

Saving a wpf layout to pdf using pdfsharp, c#

独自空忆成欢 提交于 2021-02-17 20:55:39
问题 I'm new to c#, wpf and the pdfsharp library. This is my XAML Code: <Grid> <zoom:ZoomControl> <graphsharp:GraphLayout x:Name="graphLayout" Graph="{Binding ElementName=root, Path=GraphToVisualize}" LayoutAlgorithmType="FR" OverlapRemovalAlgorithmType="FSA" HighlightAlgorithmType="Simple"></graphsharp:GraphLayout> </zoom:ZoomControl> <Button Content="Button" Height="23" Name="button1" Width="75" Margin="12,294,658,412" Click="button1_Click" /> </Grid> I want now save my "graphLayout" to a pdf

Loading a Font with PdfSharp .Net Standard preview from Xamarin.Forms fails: No appropriate font found

北战南征 提交于 2021-02-10 16:00:06
问题 I am currently assessing how to generate a PDF from Xamarin.Forms (currently running the app on Android, only) and checking the .NET Standard port of PdfSharp. Drawing to the PDF and showing it works, but I'm having issues writing text to the document. When I am trying to load an XFont with the following code var font = new XFont("sans-serif", 20); it fails with the exception System.InvalidOperationException: No appropriate font found. According to these samples, it is supposed to work this

How to add DocumentLink to existing PDF file using PdfSharp

醉酒当歌 提交于 2021-01-29 11:13:22
问题 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. 回答1: Mixing MigraDoc and PDFsharp you can get it done. You can add a Tag to the paragraphs

Filling PDF Fields with values in ASP.NET MVC 5

孤人 提交于 2021-01-29 09:00:26
问题 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: var doc = PdfReader.Open(ControllerContext.HttpContext.Server.MapPath("~/Documents/test.pdf"), PdfDocumentOpenMode.Modify); doc.AcroForm.Fields["Text1"].ReadOnly = false; That was the

How to create annotation using PdfSharp to highlight text of existing PDF

人走茶凉 提交于 2020-06-27 12:03:16
问题 I would like know whether it is possible to create an text highlight annotation in an existing PDF using PdfSharp? In the PdfSharp documentation, I see examples of PdfTextAnnotation & PdfRubberStampAnnotation , but did not find sample code for following annotations mentioned in the documentation. PdfLineAnnotation, PdfSquareAnnotation, PdfCircleAnnotation, PdfMarkupAnnotation, PdfHighlightAnnotation, PdfUnderlineAnnotation, PdfSquigglyAnnotation, PdfSoundAnnotation, PdfMovieAnnotation. Are

Is ther any open tool to convert XPS to PDF?

别来无恙 提交于 2020-06-21 04:39:47
问题 I did a lot of digging to figure out an easy way to convert an XPS document into a PDF . There are many tools that can do this but they are not free. Is there a free alternative? 回答1: A quick google search led me to this: http://www.nathanpjones.com/wp/2013/03/output-to-pdf-in-wpf-for-free/ I was able to get it to work after I trimmed down some of the code I did not need. Here is the result: using (PdfSharp.Xps.XpsModel.XpsDocument pdfXpsDoc = PdfSharp.Xps.XpsModel.XpsDocument.Open(xpsPath))

Is it possible to install fonts on an Azure App Service?

假装没事ソ 提交于 2020-04-13 06:49:47
问题 We are using MigraDoc/PDFsharp GDI+ which depends on having fonts installed to the system in order to render. We have tried embedding the fonts but the GDI+ version of MigraDoc does not seem to support this. When trying to move this component to an Azure App Service, it cannot find the fonts. Is there a way to "install" the fonts locally to the App Service so that they would be visible to GDI? 回答1: As I know, Components rely on GDI API may not work on Azure Web APP. We could find this known

How to save Pdfsharp pdfDocument to a file path

◇◆丶佛笑我妖孽 提交于 2020-02-24 11:37:13
问题 I am using the pdfsharp for my project.. I am trying to save the converted PdfDocument object to a pdf file in a specified path.. i do have this method public static PdfDocument ConvertTiff2Pdf(string docpath) { var pdfDoc = Tiff2Pdf(docpath); return pdfDoc; } this will return PdfDocument and I want to save it to a "C:\temp\docname.pdf" folder.. how can do it with csharp without using the http response.. because i have to first store it on the server then use.. please help me.. 回答1: Just call

Page truncate in right side for landscape orientation with trimmargins using PdfSharp

让人想犯罪 __ 提交于 2020-02-14 17:10:14
问题 I am talking about PdfSharp. Portrait orientation works well with margin or without margin. But In case of landscape orientation, page truncate in right side once I set any margin using TrimMargins. I have tried same thing on sample code of pdfSharp and having same problem!! Look pdf rendered well for following code page = document.AddPage(); page.Size = PdfSharp.PageSize.A4; page.Orientation = PageOrientation.Landscape; gfx = XGraphics.FromPdfPage(page); gfx.DrawString("A4 (landscape)", font