CN110956024A - Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB - Google Patents

Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB Download PDF

Info

Publication number
CN110956024A
CN110956024A CN201811043451.8A CN201811043451A CN110956024A CN 110956024 A CN110956024 A CN 110956024A CN 201811043451 A CN201811043451 A CN 201811043451A CN 110956024 A CN110956024 A CN 110956024A
Authority
CN
China
Prior art keywords
pdf
canvas
painting brush
creating
automatically drawing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811043451.8A
Other languages
Chinese (zh)
Inventor
丁继锋
张来卿
庞严冬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd
Original Assignee
Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd filed Critical Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd
Priority to CN201811043451.8A priority Critical patent/CN110956024A/en
Publication of CN110956024A publication Critical patent/CN110956024A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention relates to the technical field of software development and application, in particular to a method for automatically drawing a custom graph in PDF. The method comprises the following steps: 1. PDF, a package of operation PDF documents is referenced; 2. creating an empty PDF document object; 3. arranging a painting brush and a painting brush; 4. creating a canvas, drawing a graph and storing the canvas; 5. the PDF document is saved and opened. The invention solves the problem of automatically drawing the user-defined graph in PDF without the help of a third party tool, and can be widely applied to WEB application and development.

Description

Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB
Technical Field
The invention relates to the technical field of software development and application, in particular to a method for automatically drawing a custom graph in PDF.
Background
PDF (short for Portable Document Format) is a file Format developed by adobes systems for file exchange in a manner independent of application programs, operating systems, and hardware. The PDF file format may encapsulate text, fonts, formats, colors, and device and resolution independent graphical images, etc. in one file. The format file can also contain electronic information such as hypertext links, sound, dynamic images and the like, supports a special file, and has high integration level and high safety and reliability.
PDF documents are usually read-only and cannot be modified, and they are basically converted from other editable documents by tools. In practical application, a PDF document often needs to be directly generated through text content and graphic variables, the text content can be directly written in, but the graphics need to be automatically drawn when being generated. By referring to spiral.PDF in the program, the PDF document is directly read and written in the memory without using a third-party tool, and the graph is drawn, so that the problem of automatically drawing a user-defined graph in PDF without using the third-party tool is solved, and the method can be widely applied to software development and application processes.
Disclosure of Invention
The invention solves the technical problem of providing a method for automatically drawing a user-defined graph in PDF; the problem of need not to draw user-defined figure in PDF automatically with the help of third party's instrument is solved.
The technical scheme for solving the technical problems is as follows:
the method comprises the following steps:
step one, quoting a program package spiral. PDF of an operation PDF document;
step two, creating an empty PDF document object;
thirdly, setting a painting brush and a painting brush;
step four, creating a canvas, drawing a graph and storing the canvas;
and step five, saving and opening the PDF document.
In the method for automatically drawing the user-defined graph in the PDF, in the first step, a program package of a PDF document is referred to and operated in a project program, and the program package is generated and compiled.
In the second step, an empty PDF document object is created in the memory, and a PDF page object is created according to the PDF object.
And in the third step, creating a painting brush, a painting brush object and transparency attributes according to the predefined colors, creating different painting brush objects according to different colors, and setting different transparency attributes according to different transparencies.
And in the fourth step and the fifth step, a canvas is created, pictures are drawn on the canvas and the canvas is stored according to the paintbrushes, the transparency, the coordinate values and the attributes of different shapes, and PDF documents are stored and opened after drawing is finished.
The problem of automatically drawing the user-defined graph in the PDF without the help of a third-party tool is solved, and the method can be widely applied to software development and application processes.
Drawings
The invention is further described below with reference to the accompanying drawings:
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
As shown in fig. 1, the present invention specifically comprises the following steps:
step one, quoting a program package spiral. PDF of an operation PDF document;
step two, creating an empty PDF document object;
thirdly, setting a painting brush and a painting brush;
step four, creating a canvas, drawing a graph and storing the canvas;
and step five, saving and opening the PDF document.
In the first step, a package of a pdf document is referred to in the project program, generated and compiled.
In the second step, an empty PDF document object is created in the memory, and a PDF page object is created according to the PDF object.
New PDF document
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
And in the third step, creating a painting brush, a painting brush object and transparency attributes according to the predefined colors, creating different painting brush objects according to different colors, and setting different transparency attributes according to different transparencies.
V/instantiate brushes and brushes 1, 2
PdfPen pen = new PdfPen(Color.DeepSkyBlue, 0.02f);
PdfBrush brush1 = new PdfSolidBrush(Color.PaleGreen);
PdfBrush brush2 = new PdfSolidBrush(Color.Bisque);
Setting the basic color transparency to 1
PdfSeparationColor color1 = new PdfSeparationColor(cs1, 1f);
PdfSeparationColor color2 = new PdfSeparationColor (cs2, 1f), PdfSeparationColor 3 = new PdfSeparationColor (cs3, 1f), in the fourth step and the fifth step, creating a canvas, drawing a picture on the canvas and storing the canvas according to a brush, transparency, coordinate values and attributes of different shapes, and storing and opening a PDF document after drawing is finished.
Drawing in graphics and text and coloring
page.Canvas.DrawPie(brush1, 10, 30, 60, 60, 360, 360);
page.Canvas.DrawPie(brush2, 10, 120, 60, 60, 360, 360);page.Canvas.DrawPie(brush3, 10, 210, 60, 60, 360, 360);
Canvas & drawstring ("transparency =1.0", new pdftruetypefent (new Font ("arial unicode MS", 10f), true), brush1, new PointF (16, 100));
setting the basic color transparency to 0.5, and drawing pictures and characters
color1 = new PdfSeparationColor(cs1, 0.5f);
brush1 = new PdfSolidBrush(color1);
page.Canvas.DrawPie(brush1, 80, 30, 60, 60, 360, 360);
color2 = new PdfSeparationColor(cs2, 0.5f);
brush2 = new PdfSolidBrush(color2);
page.Canvas.DrawPie(brush2, 80, 120, 60, 60, 360, 360); color3 = newPdfSeparationColor(cs3, 0.5f);
brush3 = new PdfSolidBrush(color3);
page canvas. draw pie (brush3, 80, 210, 60, 60, 360, 360); page canvas. draw string ("transparency =0.5", new pdftruetypefent (new Font ("arial unicode MS", 10f), true), brush1, new PointF (86, 100));
// save and open document
doc.SaveToFile("xxx123.pdf");
System.Diagnostics.Process.Start("xxx123.pdf")。

Claims (5)

1. A method for automatically drawing a custom graph in PDF is characterized in that: the method comprises the following steps:
step one, quoting a program package spiral. PDF of an operation PDF document;
step two, creating an empty PDF document object;
thirdly, setting a painting brush and a painting brush;
step four, creating a canvas, drawing a graph and storing the canvas;
and step five, saving and opening the PDF document.
2. The method for automatically drawing the custom graphics in the PDF according to claim 1, wherein: in the first step, a package of a pdf document is referred to in the project program, generated and compiled.
3. The method for automatically drawing the custom graphics in the PDF according to claim 1, wherein: in the second step, an empty PDF document object is created in the memory, and a PDF page object is created according to the PDF object.
4. The method for automatically drawing the custom graphics in the PDF according to claim 1, wherein: and in the third step, creating a painting brush, a painting brush object and transparency attributes according to the predefined colors, creating different painting brush objects according to different colors, and setting different transparency attributes according to different transparencies.
5. The method for automatically drawing the custom graphics in the PDF according to claim 1, wherein: and in the fourth step and the fifth step, a canvas is created, pictures are drawn on the canvas and the canvas is stored according to the paintbrushes, the transparency, the coordinate values and the attributes of different shapes, and PDF documents are stored and opened after drawing is finished.
CN201811043451.8A 2018-09-07 2018-09-07 Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB Pending CN110956024A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811043451.8A CN110956024A (en) 2018-09-07 2018-09-07 Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811043451.8A CN110956024A (en) 2018-09-07 2018-09-07 Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB

Publications (1)

Publication Number Publication Date
CN110956024A true CN110956024A (en) 2020-04-03

Family

ID=69962106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811043451.8A Pending CN110956024A (en) 2018-09-07 2018-09-07 Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB

Country Status (1)

Country Link
CN (1) CN110956024A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1445691A (en) * 2003-04-29 2003-10-01 吴晶 Method for drawing on or sending to bulletins containing graphics bulletin boards
CN101833744A (en) * 2010-03-29 2010-09-15 广东威创视讯科技股份有限公司 Method and device for efficiently drawing graphics
CN105094835A (en) * 2015-08-11 2015-11-25 金蝶软件(中国)有限公司 Graph drawing method and device
JP2017151913A (en) * 2016-02-26 2017-08-31 株式会社スカイコム Pdf file management system, pdf file management server, pdf file data acquiring server, pdf file management method, pdf file data acquiring method, pdf file management program, and pdf file data acquiring program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1445691A (en) * 2003-04-29 2003-10-01 吴晶 Method for drawing on or sending to bulletins containing graphics bulletin boards
CN101833744A (en) * 2010-03-29 2010-09-15 广东威创视讯科技股份有限公司 Method and device for efficiently drawing graphics
CN105094835A (en) * 2015-08-11 2015-11-25 金蝶软件(中国)有限公司 Graph drawing method and device
JP2017151913A (en) * 2016-02-26 2017-08-31 株式会社スカイコム Pdf file management system, pdf file management server, pdf file data acquiring server, pdf file management method, pdf file data acquiring method, pdf file management program, and pdf file data acquiring program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
OFFICE文档开发: "C#如何在PDF中绘制图形", 《HTTPS://JINGYAN.BAIDU.COM/ARTICLE/0964ECA25844628285F536C7.HTML》 *

Similar Documents

Publication Publication Date Title
JP6507472B2 (en) Processing method, processing system and computer program
AU2005202722B2 (en) Common charting using shapes
WO2020192463A1 (en) Display method and apparatus
US7730399B2 (en) Journal file reader
US8832548B2 (en) System and method for selective control of zoom adjustments in an electronic publication
CN100356372C (en) Generating method of computer format document and opening method
CN100543725C (en) A kind of method for the E-seal location
US9141596B2 (en) System and method for processing markup language templates from partial input data
CN111241454A (en) Method, system and device for generating webpage code
US8243317B2 (en) Hierarchical arrangement for spooling job data
CN110705237B (en) Automatic document generation method, data processing device and storage medium
CN110096275B (en) Page processing method and device
EP1126379A1 (en) Conversion of directly assigned document format attributes
CN106708506A (en) Method and device for optimizing starting speed of Android applications visually
CN103309849B (en) A kind of docx document creation based on OpenXML and amending method
JP6228106B2 (en) Obfuscating page description language output to prevent conversion to editable format
US8988692B2 (en) Information processing apparatus, information processing method, and storage medium
CN110968294A (en) Business domain model establishing system and method
US8365066B2 (en) Systems and methods for processing markup language specified spreadsheet styles
US20110197117A1 (en) Systems and methods for processing color information in spreadsheets
US7757165B1 (en) Method and system for deriving and matching local formatting in an electronic document
CN113867694A (en) Method and system for intelligently generating front-end code
CN110956024A (en) Method for automatically drawing custom graph in PDF (Portable document Format) based on WEB
US20140198111A1 (en) Method and system for preserving a graphics file
US7154511B2 (en) Fast rendering of ink

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200403