Here you can search through the pages of this Namespace, their attachments and the files uploaded to the system.
Note: the results will only display the items you have permissions to read.
[...] XGraphics.FromPdfPage(page);
DrawTitle(page, gfx, "Lines & Curves");
DrawLine(gfx, 1);
DrawLines(gfx, 2);
DrawBezier(gfx, 3);
DrawBeziers(gfx, 4);
DrawCurve(gfx, 5);
DrawArc(gfx, 6);
}
Draw simple lines
void DrawLine(XGraphics gfx, int number)
{
BeginBox(gfx, number, "DrawLine");
gfx.DrawLine(XPens.DarkGreen, 0, 0, 250, 0);
gfx.DrawLine(XPens.Gold, 15, 7, 230, 15);
XPen pen = new XPen(XColors.Navy, 4);
gfx.DrawLine(pen, 0, 20, 250, 20);
pen = new XPen(XColors.Firebrick, 6);
pen.DashStyle = XDashStyle.Dash;
gfx.DrawLine(pen, 0, 40, 250, 40);
pen.Width [...]
[...]
// Define a rotation transformation at the center of the page.
gfx.TranslateTransform(page.Width / 2, page.Height / 2);
gfx.RotateTransform(-Math.Atan(page.Height / page.Width) * 180 / Math.PI);
gfx.TranslateTransform(-page.Width / 2, -page.Height / 2);
// Create a string format.
var format = new XStringFormat();
format.Alignment = XStringAlignment.Near;
format.LineAlignment = XLineAlignment.Near;
// Create a dimmed red brush.
XBrush brush = new XSolidBrush(XColor.FromArgb(128, [...]
[...] 1;
else
{
// Set page number (which is one-based) for left side
form.PageNumber = allpages + 2 * (1 - idx);
box = new XRect(0, 0, width / 2, height);
// Draw the page identified by the page number like an image
gfx.DrawImage(form, box);
}
// Set page number (which is one-based) for right side
form.PageNumber = 2 * idx - 1;
box = new XRect(width / 2, 0, width / 2, height);
// Draw the page identified by the page number like an image
[...]
[...] style.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
style.ParagraphFormat.Borders.Width = 2.5;
style.ParagraphFormat.Borders.Distance = "3pt";
style.ParagraphFormat.Shading.Color = Colors.SkyBlue;
// Create a new style called TOC based on style Normal
style = document.Styles.AddStyle("TOC", "Normal");
style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right, TabLeader.Dots);
style.ParagraphFormat.Font.Color = Colors.Blue;
}
DefineCover is called by CreateDocument :
///
/// Defines the cover page.
///
public static void DefineCover(Document [...]
[...] the header
Image image = section.Headers.Primary.AddImage("../../PowerBooks.png");
image.Height = "2.5cm";
image.LockAspectRatio = true;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
image.Top = ShapePosition.Top;
image.Left = ShapePosition.Right;
image.WrapFormat.Style = WrapStyle.Through;
// Create footer
Paragraph paragraph = section.Footers.Primary.AddParagraph();
paragraph.AddText("PowerBooks Inc · Sample Street 42 · 56789 Cologne · Germany");
paragraph.Format.Font.Size = 9;
paragraph.Format.Alignment [...]
[...]
PdfDocument document = new PdfDocument();
// Sample uses DIN A4, page height is 29.7 cm. We use margins of 2.5 cm.
LayoutHelper helper = new LayoutHelper(document, XUnit.FromCentimeter(2.5), [...]
[...] transparent rectangle to visualize the area the form occupies
XColor back = XColors.Orange;
back.A = 0.2;
XSolidBrush brush = new XSolidBrush(back);
formGfx.DrawRectangle(brush, -10000, -10000, 20000, 20000);
// On a form you can draw...
// ... text
formGfx.DrawString("Text, Graphics, Images, and Forms", new XFont("Verdana", 10, XFontStyle.Regular), XBrushes.Navy, 3, 0, XStringFormats.TopLeft);
XPen pen = XPens.LightBlue.Clone();
pen.Width = 2.5;
// ... graphics like Bézier curves
formGfx.DrawBeziers(pen, XPoint.ParsePoints("30,120 80,20 [...]
[...] uses GDI+ for some image operations. GDI+ Build
The GDI+ build of PDFsharp still compiles with .NET 2.0 and C# 2. It can be used in WinForms and Web applications, as well as in WPF applications. Most PDFsharp samples are available for the GDI+ build. .NET 1.1 is not supported anymore. WPF Build
The WPF build [...]
[...] PDF versions are supported by PDFsharp?
With PDFsharp you can create files with PDF versions from 1.2 (Adobe Acrobat Reader 3.0) through 1.7 (Adobe Reader 8.0).
PDFsharp fully supports PDF 1.4 (Adobe Reader 5.0) including the transparency features introduced with this version.
Some features of PDF 1.5 (Adobe Reader 6.0) are not yet implemented. Therefore PDFsharp cannot yet open all files marked for PDF 1.5 or higher (but that's on our Roadmap ).
Since not all compression features of PDF 1.5 are implemented, with some files the file size may increase when they are processed [...]
[...] PageSetup
{
PageHeight = "29.7cm"
PageWidth = "21cm"
Orientation = Portrait
LeftMargin = "2.5cm"
RightMargin = "2.5cm"
[...]
[...] and bound decoder on the long edge.
At first you see page 1. Flip the page over and you will see page 2 on the left and page 3 on the right. To get this, set "MirrorMargins" in MigraDoc to true. If you do this, "LeftMargin" will become the inner margin and "RightMargin" will be the outer margin.
"LeftMargin" will be the left margin on pages 1, 3, ... but will be the right margin on pages 2, [...]
[...] PdfReference object of that page.
// (The index in the Pages collection is zero based, therefore Pages[2])
PdfReference iref = PdfInternals.GetReference(document.Pages[2]);
[...]
[...] annotation which is open and transparent
textAnnot = new PdfTextAnnotation();
textAnnot.Title = "Annotation 2 (title)";
textAnnot.Subject = "Annotation 2 [...]
[...] if you want to use images from application resources, databases, or streams? With PDFsharp 1.50 beta 2, a new feature was added: MigraDoc now accepts filenames that contain BASE64-encoded images with the prefix "base64:". In this case, the filename does not refer to a file, the filename contains all the bits of the bitmap in an ASCII string with the BASE64 encoding. So the filename can be very long, depending on the size of the file. A byte array (byte[] in C#) can easily be converted to a filename.
If you have a stream, you can easily read it into a byte array and use [...]
[...]
' Draw an ellipse
gfx.DrawEllipse(pen, 3 * page.Width.Point / 10, 3 * page.Height.Point / 10, 2 * page.Width.Point / 5, 2 [...]
[...] double width = gfx.PageSize.Width;
double height = gfx.PageSize.Height;
gfx.TranslateTransform(width / 2, height / 2);
[...]
[...] with IE 8
Pasting (Ctrl-V) in WikiMarkup scrolls cursor out of view. Does not occur with version 2.x. Firefox
On page http://www.pdfsharp.net/wiki-1.5/Graphics-sample.ashx [...]
[...] ls;
gfx.DrawString("The object used for drawing is the XGraphics object.",
font, XBrushes.Black, x, y);
y += 2 * ls;
// Draw an arc
pen = new XPen(XColors.Red, [...]
PDFsharp requires the .NET Framework 2 and is written entirely in C#. It was developed [...]
Table Rendering Table rendering is was very slow if tables are long. As of version 1.50 beta 2, table rendering is much faster (1.50 beta [...]
[...] Output File
See the PDF files created by this sample: Variation 1 output.pdf (207 kB) Variation 2 output.pdf (211 kB) Variation 3 output.pdf [...]
[...] Note: When using the GDI build, you can use the XPrivateFontCollection class. As of PDFsharp 1.50 beta 2, the XPrivateFontCollection class is the recommended [...]
[...] document.Outlines.Add("Root", page, true, PdfOutlineStyle.Bold, XColors.Red);
// Create some more pages
for (int idx = 2; idx Note: The samples on this site usually [...]
[...] created by this sample: output.pdf (134 kB) Screen Shots Here is a sample screen shot (showing page 2 with 6 pages from MigraDoc, scaled down to [...]