本文整理匯總了C#中PdfSharp.Pdf.PdfPage類的典型用法代碼示例。如果您正苦於以下問題:C# PdfPage類的具體用法?C# PdfPage怎麽用?C# PdfPage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PdfPage類屬於PdfSharp.Pdf命名空間,在下文中一共展示了PdfPage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Genereer
public static bool Genereer(Deelnemer deelnemer, DeelnemerVerhuisd deelnemerVerhuisd)
{
_deelnemer = deelnemer;
_event = deelnemerVerhuisd;
// start pdf document
_document = new PdfDocument();
_document.Info.Title = "Verhuisbrief " + _deelnemer.Naam;
_document.Info.Author = "Verhuisbrief Generator";
// voeg pagina toe
_page = _document.AddPage();
_gfx = XGraphics.FromPdfPage(_page);
// vul pagina
PlaatsLogo();
PlaatsTitel();
PlaatsNAWGegevens();
PlaatsInhoud();
// sla document op
SlaPdfOp();
return true;
}
示例2: Export_to_Pdf
public Export_to_Pdf()
{
InitializeComponent();
//Create object for pdf.
document = new PdfDocument();
page = document.AddPage();
gfx = XGraphics.FromPdfPage(page);
//Set by default values.
font = new XFont("Arial", 12, XFontStyle.Regular);
header_font = new XFont("Arial", 12, XFontStyle.Regular);
page.Size = PageSize.A4;
page.Orientation = PageOrientation.Portrait;
//////////////////////////////////////////////////////////////////////
//Create a fake questionanire to test the print process to pdf.
if (questionaire != null)
{
List<Question> question_list = new List<Question>();
List<Answer> answer_list = new List<Answer>();
Answer ans = new Answer();
ans.Answer_descr = "einai to dsfgdsfgsd";
answer_list.Add(ans);
answer_list.Add(ans);
answer_list.Add(ans);
Question quest = new Question() { AnswerList = answer_list };
quest.Question_descr = "H ekfoonisi tis erotisis aytis einai blablbalbablbalblab";
for (int i = 0; i < 10; i++)
{
question_list.Add(quest);
}
questionaire = new Quastionnaire.Model.Questionaire() { Questionaire_descr = "sdfsakdfjdflshsadflkjashflasdfkh", QuestionList = question_list };
}
//////////////////////////////////////////////////////////////////////
}
示例3: Create
public void Create(string filename, int qcount, int cellsinq, List<string> cellslabels,int rowscount)
{
s_document = new PdfDocument();
_page = new PdfPage();
_page.Orientation = PageOrientation.Landscape;
_page.Size = PageSize.A4;
s_document.Pages.Add(_page);
gfx = XGraphics.FromPdfPage(_page);
DrawCenterMarker(7);
DrawSideMarker(7, 10, 10);
DrawSideMarker(7, 285, 10);
DrawSideMarker(7, 10, 200);
DrawSideMarker(7, 285, 200);
AddFields();
AddQuestions(qcount,cellsinq,cellslabels,rowscount);
// Save the s_document...
s_document.Save(filename);
// ...and start a viewer
Process.Start(filename);
}
示例4: Visit
public override void Visit(ExportPage page)
{
PdfPage = pdfDocument.AddPage();
xGraphics = XGraphics.FromPdfPage(PdfPage);
textFormatter = new XTextFormatter(xGraphics);
base.Visit(page);
}
示例5: RenderPage
internal void RenderPage(PdfPage page, FixedPage fixedPage)
{
this.page = page;
this.context = new DocumentRenderingContext(page.Owner);
//this.page.Width = fixedPage.Width;
//this.page.Height = fixedPage.Height;
//this.gsStack = new GraphicsStateStack(this);
PdfContent content = null;
//switch (options)
//{
// case XGraphicsPdfPageOptions.Replace:
// page.Contents.Elements.Clear();
// goto case XGraphicsPdfPageOptions.Append;
// case XGraphicsPdfPageOptions.Prepend:
// content = page.Contents.PrependContent();
// break;
// case XGraphicsPdfPageOptions.Append:
content = page.Contents.AppendContent();
// break;
//}
page.RenderContent = content;
this.writer = new PdfContentWriter(this.context, this.page);
//Initialize();
this.writer.BeginContent(false);
this.writer.WriteElements(fixedPage.Content);
this.writer.EndContent();
}
示例6: addNextPDF
private void addNextPDF()
{
PdfPage page = new PdfPage();
page.Size = PageSize.A4;
double h = SystemParameters.PrimaryScreenHeight;
double w = SystemParameters.PrimaryScreenWidth;
//XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
var rateW = page.Width / w;
var rateH = page.Height / h;
var strokes = CanvasStroke.ToList();
List<Point[]> pl = new List<Point[]>();
foreach (Stroke stroke in strokes)
{
StylusPointCollection points = stroke.StylusPoints;
StylusPointCollection newPoints = new StylusPointCollection();
var pointList = points.ToList();
foreach (StylusPoint pt in pointList)
{
StylusPoint newPt = new StylusPoint(pt.X * rateW, pt.Y * rateH);
newPoints.Add(newPt);
}
Point[] p = (Point[])newPoints;
pList.Add(p);
pl.Add(p);
CanvasStroke.Remove(stroke);
}
pointL.Add(pl);
}
示例7: CParser
public CParser(PdfPage page)
{
this.page = page;
PdfContent content = page.Contents.CreateSingleContent();
byte[] bytes = content.Stream.Value;
this.lexer = new CLexer(bytes);
}
示例8: CreatePage
/// <summary>
/// Create new page
/// </summary>
void CreatePage()
{
Page = _document.AddPage();
Page.Size = PageSize.A4;
Gfx = XGraphics.FromPdfPage(Page);
_currentPosition = _topPosition;
}
示例9: PdfOutline
/// <summary>
/// Initializes a new instance of the <see cref="PdfOutline"/> class.
/// </summary>
/// <param name="title">The outline text.</param>
/// <param name="destinationPage">The destination page.</param>
/// <param name="opened">Specifies whether the node is displayed expanded (opened) or collapsed.</param>
/// <param name="style">The font style used to draw the outline text.</param>
/// <param name="textColor">The color used to draw the outline text.</param>
public PdfOutline(string title, PdfPage destinationPage, bool opened, PdfOutlineStyle style, XColor textColor)
{
Title = title;
DestinationPage = destinationPage;
Opened = opened;
Style = style;
TextColor = textColor;
}
示例10: GetImagesFromPage
private IEnumerable<IScannedImage> GetImagesFromPage(PdfPage page)
{
// Get resources dictionary
PdfDictionary resources = page.Elements.GetDictionary("/Resources");
if (resources == null)
{
yield break;
}
// Get external objects dictionary
PdfDictionary xObjects = resources.Elements.GetDictionary("/XObject");
if (xObjects == null)
{
yield break;
}
// Iterate references to external objects
foreach (PdfItem item in xObjects.Elements.Values)
{
var reference = item as PdfReference;
if (reference == null)
{
continue;
}
var xObject = reference.Value as PdfDictionary;
// Is external object an image?
if (xObject != null && xObject.Elements.GetString("/Subtype") == "/Image")
{
// Support multiple filter schemes
// For JPEG: "/DCTDecode" OR ["/DCTDecode", "/FlateDecode"]
// For PNG: "/FlateDecode"
var element = xObject.Elements.Single(x => x.Key == "/Filter");
var elementAsArray = element.Value as PdfArray;
var elementAsName = element.Value as PdfName;
if (elementAsArray != null)
{
// JPEG ["/DCTDecode", "/FlateDecode"]
yield return ExportJpegImage(page, Filtering.Decode(xObject.Stream.Value, "/FlateDecode"));
}
else if (elementAsName != null)
{
switch (elementAsName.Value)
{
case "/DCTDecode":
yield return ExportJpegImage(page, xObject.Stream.Value);
break;
case "/FlateDecode":
yield return ExportAsPngImage(page, xObject);
break;
default:
throw new NotImplementedException("Unsupported image encoding");
}
}
else
{
throw new NotImplementedException("Unsupported filter");
}
}
}
}
示例11: PdfPrintTarget
static PdfPrintTarget()
{
m_doc = new PdfDocument();
m_page = m_doc.AddPage();
m_info = XGraphics.FromPdfPage(m_page);
m_size = PageSizeConverter.ToSize(m_page.Size);
m_mmkx = m_size.Width / 210.0f;
m_mmky = m_size.Height / 297.0f;
}
示例12: XGraphicsPdfRenderer
public XGraphicsPdfRenderer(PdfPage page, XGraphics gfx, XGraphicsPdfPageOptions options)
{
_page = page;
_colorMode = page._document.Options.ColorMode;
_options = options;
_gfx = gfx;
_content = new StringBuilder();
page.RenderContent._pdfRenderer = this;
_gfxState = new PdfGraphicsState(this);
}
示例13: PdfContentWriter
/// <summary>
/// Initializes a new instance of the <see cref="PdfContentWriter"/> class
/// for creating a content stream of the specified page.
/// </summary>
public PdfContentWriter(DocumentRenderingContext context, PdfPage page) // , XGraphics gfx, XGraphicsPdfPageOptions options)
{
this.context = context;
this.page = page;
this.contentStreamDictionary = page;
//this.colorMode = page.document.Options.ColorMode;
//this.options = options;
this.content = new StringBuilder();
this.graphicsState = new PdfGraphicsState(this);
}
示例14: DrawPage
public void DrawPage(PdfPage page)
{
XGraphics gfx = XGraphics.FromPdfPage(page);
DrawTitle(page, gfx, "Text");
DrawText(gfx, 1);
DrawTextAlignment(gfx, 2);
MeasureText(gfx, 3);
}
示例15: OHS_Page
public OHS_Page(PdfPage page, ProfileInfo userProfile, List<Parameter> userParameters)
{
this.page = page;
this.userProfile = userProfile;
foreach (Parameter p in userParameters)
this.userParameters.Add(p.Name, p);
quaterWidth = page.Width / 4;
}