Method for exporting size of PDF (Portable Document Format) drawing

By automatically analyzing the size information in PDF drawings using the PDFium library and generating an EXCEL detection table, the problem of inefficient manual detection and recording of PDF drawings in the prior art is solved, and automated detection and efficient recording are achieved.

CN120012190APending Publication Date: 2025-05-16NANJING WIT SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411960728.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

In the prior art, the detection and recording of PDF drawing sizes requires manual operation, which leads to inefficiency, prone to human errors, and takes a long time to process complex drawings.

Method used

By selecting PDF drawings, use the open source library PDFium to automatically analyze the text location and content in the drawings, identify the size text, tolerance text and size serial number text, and generate the component size detection table in EXCEL format.

Benefits of technology

The operation process of the inspectors has been greatly simplified, the size analysis and recording are automated, the work efficiency has been significantly improved, and the occurrence of human errors has been reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120012190A_ABST
    Figure CN120012190A_ABST
Patent Text Reader

Abstract

The invention provides a method for exporting the size of a PDF drawing. The method comprises the following steps that S1, the PDF drawing is selected; s2, obtaining a PDF text position; s3, analyzing the data; s4, obtaining a part dimension detection table; according to the method and the system, the operation of detection personnel is simplified, PDF drawings are selected on software, sizes and size serial numbers are automatically analyzed, PDF drawing size records are directly exported, manual analysis of the drawings is not needed, manual recording of the sizes and tolerances is not needed, and all PDF drawing size record tables can be output within several seconds for one PDF drawing; the problem of early-stage detection work of detection personnel is solved, the detection personnel concentrate on work for verifying whether the parts are qualified or not, and the working efficiency of the detection personnel is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of computer science, and in particular to a method for exporting PDF drawing size. Background Art

[0002] During the product manufacturing process, after the digital model design is completed, the design company will issue a complete mechanical engineering drawing, which includes views, dimensions, processing requirements and other information; and send it to the parts supplier in the form of PDF drawings. After the parts supplier completes the production, in order to ensure that the produced parts meet the design requirements, all dimensions marked on the PDF drawings need to be tested to verify whether the product meets the design requirements; In the current workflow, inspectors usually rely on manual inspection of PDF drawings to ensure that the dimensions of parts are consistent with design requirements. Inspectors need to extract all dimension information from PDF drawings, including the dimension marking location, dimension value and its corresponding number, and manually record this information into Excel tables. Inspectors compare the dimensions of the design drawings with the dimensions of the actual manufactured parts to confirm whether they meet the design requirements. This process usually takes a long time. The size extraction and inspection of each PDF drawing may take 1 to 2 hours. Especially when the drawings have many sizes and complex annotations, manual recording and numbering further increase the workload. The tediousness of manual operation can easily lead to human errors, increase the workload, and fail to effectively improve work efficiency. Therefore, the current inspection process has a large bottleneck in processing efficiency and accuracy. Summary of the invention

[0003] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a method for exporting PDF drawing dimensions.

[0004] To achieve the above object, the present invention adopts the following technical solutions: A method for exporting PDF drawing dimensions, comprising the following steps: S1: Select PDF drawing; Select the PDF drawing corresponding to the specific digital model according to actual needs; The PDF drawings are engineering drawings of digital models designed by engineers, which are two-dimensional engineering drawings associated with three-dimensional models created by three-dimensional design software, and contain views, dimensions, annotations, drawing frames, detail columns, etc. of the digital model; The views include front view, side view, sectional view, etc.; The dimensions are the dimensions of the various parts of the components corresponding to the digital model; The drawing frame includes the drawing number, version number, drawing date, etc.; The details column includes component name, material, weight, etc.

[0005] S2: Get the PDF text position; In the PDF drawing selected in step S1, the position coordinates and text content of the text information contained in the PDF drawing are obtained; The text information includes dimension text, annotation text, etc. The following sub-steps are included: S21: Configure and initialize the open source library PDFium; Configure the open source library PDFium in the project where the PDF drawings are located, and call the FPDF_InitLibrary function to load and initialize the PDFium library; the open source library PDFium contains the PDF drawings corresponding to each 3D model; S22: Get the valid range in the PDF drawing; The user selects a PDF drawing in the open source library PDFium through the choosePDFFile function, and the PDF drawing is the PDF drawing selected in step S1; Open the PDF drawing through the FPDF_LoadDocument function of the open source library PDFium, and get the number of pages of the PDF drawing through the FPDF_GetPageCount function; Further, the specified page is obtained through the FPDF_LoadPage function, and the specified text page is loaded through the FPDFText_LoadPage function; Use FPDF_GetPageSizeByIndex function to get the width and height of each page of PDF drawing; cut the width and height of the page based on the drawing frame rule to get the valid range of PDF drawing; S23: Obtaining the contour points of the characters contained in each text within the valid range in the PDF drawing; Use the FPDFText_CountChars function to get all characters in the valid range of the PDF drawing; Use FPDFText_GetCharBox to get the value of the bounding box of each character, that is, the boundary values ​​of the top, bottom, left, and right boundaries, which are recorded as top, bottom, left, and right respectively; the boundary values ​​are based on the coordinate system of the lower left corner of the PDF drawing page; According to the boundary value, calculate the four contour points of each character, record the four contour points: the upper left is P0, the upper right is P1, the lower left is P2, the lower right is P3, the character length is L1, and the character height is H1; but , , , ; The character length L1 = right - left, that is, the difference between the left and right boundaries, and the character height H1 = top - bottom, that is, the difference between the upper and lower boundaries.

[0006] S3: Analyze data; The following sub-steps are included: S31: Recognize dimension text; It contains the following sub-steps: S311: Calculate character spacing; According to the contour points of the characters obtained in step S2, the horizontal spacing between adjacent characters is calculated in sequence, and the calculation method is as follows: Assume that characters A and B are adjacent characters, and the character spacing between characters A and B is d1, d1 = |A.P1 -B.P0|; that is, the distance between the right point P1 of character A and the left point P0 of character B; if d1 is 0, it means that characters A and B are closely connected and there is no horizontal spacing; S312: Calculate character height; Note that the character height of character A is d2, and the character height of character B is d3; d2=|A.P3 - A.P0|, that is, the vertical distance between the contour points P3 and P0 of character A, d3=|B.P3 - B.P0|: the vertical distance between the contour points P3 and P0 of character B; S313: Determine whether the characters are a group; When two characters satisfy d1=0 and d2=d3, the two characters are considered to be a group; otherwise, they do not constitute a group of characters. For all characters, loop through steps S311-S313, calculate the spacing and height between adjacent characters in turn, and determine whether they belong to the same group, until all characters are determined; The characters in the same group form a text, and all the texts composed of the characters are obtained; S314: Determine whether it is a dimension text; It is determined in turn whether the text obtained in step S313 is a dimension text, that is, when the text does not contain any characters other than numbers or decimal points, it is a dimension text; otherwise, it is not a dimension text; Merge the contour points of all characters in the dimension text, find the leftmost point, rightmost point, topmost point, and bottommost point of all character contours, and get the four contour points of the text: P0, P1, P2, and P3; S32: Recognize tolerance text; Determine whether the text obtained in step S313 is a tolerance text, and the determination method includes the following sub-steps: S321: Perform symbol judgment; Check whether the text contains a "+" or "-" sign. If not, it is not a tolerance text. If it does, go to step S322. S322: Perform position determination; Use the distance formula to calculate the distance between the point P0 in the text and the dimension text obtained in step S314. If the distance is 0, proceed to step S323; otherwise, it is not a tolerance text. S323: Make a height judgment; Use the distance formula to calculate the height of the text, that is, the distance between points P3 and P0. If the distance is the height of the dimension text, that is, 1 / 2 of the distance between points P3 and P0 of the dimension text, then go to step S324; otherwise, it is not a tolerance text. S324: judging the composition of the text; If the text contains only numbers and decimal points besides the symbols "+" or "-", it is a tolerance text; otherwise it is not a tolerance text; Associating the obtained tolerance text with the corresponding dimension text; S33: Identify the size serial number text; The dimension text obtained in step S31 is further judged. If the dimension text only contains numbers and the position of the text is within the valid range of the PDF drawing, the dimension text is judged to be dimension serial number text; otherwise, it is not dimension serial number text; S34: Dimension number text associated with dimension text; Connect the points P0 and P2 of the dimension serial number text to form a line segment P0P2. Let the midpoint of this line segment be PM=(PMx,PMy), PMx=(P0x+P2x) / 2, PMy=(P0y+P2y) / 2; Get the midpoint of the dimension serial number text according to the position of the dimension serial number text; Calculate the distance from the midpoint of the dimension serial number text to the dimension text according to the distance formula, and record the distance as d4; Similarly, the distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text is calculated according to the distance calculation formula, and is recorded as d5 and d6; The d5 is the horizontal distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text; that is, it is obtained by calculating the distance from the midpoint of the dimension serial number text to the midpoint of the tolerance text associated with the dimension text in the horizontal direction; The d6 is the vertical distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text; that is, it is obtained by calculating the distance from the midpoint of the dimension serial number text to the midpoint of the tolerance text associated with the dimension text in the vertical direction; S35: Dimension number text associated with dimension text; Note the length L1 of the dimension text, where L1 is the horizontal distance between dimension text P0 and P1. If any value among d4, d5, and d6 is smaller than the length L1 of the dimension text, the dimension serial number text is determined to be associated with the dimension text. S36: Calculate the dimension text partition position; Set the partitioning method of the PDF drawing to use Arabic numerals for horizontal partitions and uppercase letters for vertical partitions; and set the spacing to S, and the interval range of S is [25, 75]; Calculate the specific area of ​​the dimension text coordinates (Xt, Yt) in the drawing, round down the value obtained by Xt / S and add 1 to get the horizontal partition number; round down the value obtained by Yt / S and add 1 to get the number in the order of uppercase letters in the alphabet, and get the uppercase letters as the vertical partition number; confirm the partition position of the dimension text by confirming the partition position of the coordinates of each contour point of the dimension text in the PDF drawing; S37: Get title bar information; Define the position and size range of the title bar; The title bar area contains text information such as unit name, drawing number, signature column, date column, etc.; Use openpyxl component to get the text content in the title bar.

[0007] S4: Get the component size inspection table; The component size inspection table includes information such as component design dimensions, processing requirements, inspection tools, and verification results; The following sub-steps are included: S41: Calling the component dimension inspection table template; Use the copy command to copy the existing component size inspection table template to the specified directory; the component size inspection table template is an Excel file; S42: Fill in detailed data; Start the Excel application through the CreateDispatch component; Use the _Workbook component to open the component dimension inspection table template copied to the specified directory; Get all pages through Workbooks, specify the first worksheet as the operation object, get the page cells through Range, and fill the dimension text, dimension serial number text, dimension tolerance text, dimension area position, title bar information and other data obtained in step S3 into the worksheet through the SetItem method; After the operation is completed, use ReleaseDispatch to release resources and save the component size detection table; After saving, close the Excel program and exit, ensuring that the generated component dimension inspection table is correctly saved in the specified directory.

[0008] Compared with the prior art, the present invention has the following beneficial effects: The method system of the present invention simplifies the operation of the inspector. The software selects the PDF drawing, automatically analyzes the size and size number, and directly exports the PDF drawing size record. There is no need to manually analyze the drawing, and there is no need to manually record the size and tolerance. It only takes a few seconds to output all the PDF drawing size record tables for one PDF drawing. The method solves the preliminary work of the inspector, allowing the inspector to focus on verifying whether the parts are qualified, thereby improving the work efficiency of the inspector. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 The present invention is a flowchart of the steps of a method for exporting PDF drawing dimensions. DETAILED DESCRIPTION

[0010] In order to provide a further understanding of the purpose, structure, features, and functions of the present invention, the following detailed description is given in conjunction with the embodiments.

[0011] like Figure 1 As shown, a method for exporting PDF drawing dimensions includes the following steps: S1: Select PDF drawing; Select the PDF drawing corresponding to the specific digital model according to actual needs; The PDF drawings are engineering drawings of digital models designed by engineers, which are two-dimensional engineering drawings associated with three-dimensional models created by three-dimensional design software, and contain views, dimensions, annotations, drawing frames, detail columns, etc. of the digital model; The views include front view, side view, sectional view, etc.; The dimensions are the dimensions of the various parts of the components corresponding to the digital model; The drawing frame includes the drawing number, version number, drawing date, etc.; The details column includes component name, material, weight, etc.

[0012] S2: Get the PDF text position; In the PDF drawing selected in step S1, the position coordinates and text content of the text information contained in the PDF drawing are obtained; The text information includes dimension text, annotation text, etc. The following sub-steps are included: S21: Configure and initialize the open source library PDFium; Configure the open source library PDFium in the project where the PDF drawings are located, and call the FPDF_InitLibrary function to load and initialize the PDFium library; the open source library PDFium contains the PDF drawings corresponding to each 3D model; S22: Get the valid range in the PDF drawing; The user selects a PDF drawing in the open source library PDFium through the choosePDFFile function, and the PDF drawing is the PDF drawing selected in step S1; Open the PDF drawing through the FPDF_LoadDocument function of the open source library PDFium, and get the number of pages of the PDF drawing through the FPDF_GetPageCount function; Further, the specified page is obtained through the FPDF_LoadPage function, and the specified text page is loaded through the FPDFText_LoadPage function; Use FPDF_GetPageSizeByIndex function to get the width and height of each page of PDF drawing; cut the width and height of the page based on the drawing frame rule to get the valid range of PDF drawing; By cropping, you can remove useless margins or blank areas in PDF drawings. After removing useless margins and blank areas, the size of the PDF file will be significantly reduced, which not only saves storage space but also speeds up the loading and processing of files. S23: Obtaining the contour points of the characters contained in each text within the valid range in the PDF drawing; Use the FPDFText_CountChars function to get all characters in the valid range of the PDF drawing; Use FPDFText_GetCharBox to get the value of the bounding box of each character, that is, the boundary values ​​of the top, bottom, left, and right boundaries, which are recorded as top, bottom, left, and right respectively; the boundary values ​​are based on the coordinate system of the lower left corner of the PDF drawing page; According to the boundary value, calculate the four contour points of each character, record the four contour points: the upper left is P0, the upper right is P1, the lower left is P2, the lower right is P3, the character length is L1, and the character height is H1; but , , , ; The character length L1 = right - left, that is, the difference between the left and right boundaries, and the character height H1 = top - bottom, that is, the difference between the upper and lower boundaries.

[0013] S3: Analyze data; The following sub-steps are included: S31: Recognize dimension text; It contains the following sub-steps: S311: Calculate character spacing; According to the contour points of the characters obtained in step S2, the horizontal spacing between adjacent characters is calculated in sequence, and the calculation method is as follows: Assume that characters A and B are adjacent characters, and the character spacing between characters A and B is d1, d1 = |A.P1 -B.P0|; that is, the distance between the right point P1 of character A and the left point P0 of character B; if d1 is 0, it means that characters A and B are closely connected and there is no horizontal spacing; S312: Calculate character height; Note that the character height of character A is d2, and the character height of character B is d3; d2=|A.P3 - A.P0|, that is, the vertical distance between the contour points P3 and P0 of character A, d3=|B.P3 - B.P0|: the vertical distance between the contour points P3 and P0 of character B; S313: Determine whether the characters are a group; When two characters satisfy d1=0 and d2=d3, the two characters are considered to be a group; otherwise, they do not constitute a group of characters. For all characters, loop through steps S311-S313, calculate the spacing and height between adjacent characters in turn, and determine whether they belong to the same group, until all characters are determined; The characters in the same group form a text, and all the texts composed of the characters are obtained; S314: Determine whether it is a dimension text; It is determined in turn whether the text obtained in step S313 is a dimension text, that is, when the text does not contain any characters other than numbers or decimal points, it is a dimension text; otherwise, it is not a dimension text; Merge the contour points of all characters in the dimension text, find the leftmost point, rightmost point, topmost point, and bottommost point of all character contours, and get the four contour points of the text: P0, P1, P2, and P3; S32: Recognize tolerance text; Determine whether the text obtained in step S313 is a tolerance text, and the determination method includes the following sub-steps: S321: Perform symbol judgment; Check whether the text contains a "+" or "-" sign. If not, it is not a tolerance text. If it does, go to step S322. S322: Perform position determination; Use the distance formula to calculate the distance between the point P0 in the text and the dimension text obtained in step S314. If the distance is 0, proceed to step S323; otherwise, it is not a tolerance text. S323: Make a height judgment; Use the distance formula to calculate the height of the text, that is, the distance between points P3 and P0. If the distance is the height of the dimension text, that is, 1 / 2 of the distance between points P3 and P0 of the dimension text, then go to step S324; otherwise, it is not a tolerance text. S324: judging the composition of the text; If the text contains only numbers and decimal points besides the symbols "+" or "-", it is a tolerance text; otherwise it is not a tolerance text; Associating the obtained tolerance text with the corresponding dimension text; S33: Identify the size serial number text; The dimension text obtained in step S31 is further judged. If the dimension text only contains numbers and the position of the text is within the valid range of the PDF drawing, the dimension text is judged to be dimension serial number text; otherwise, it is not dimension serial number text; S34: Dimension number text associated with dimension text; Connect the points P0 and P2 of the dimension serial number text to form a line segment P0P2. Let the midpoint of this line segment be PM=(PMx,PMy), PMx=(P0x+P2x) / 2, PMy=(P0y+P2y) / 2; Get the midpoint of the dimension serial number text according to the position of the dimension serial number text; Calculate the distance from the midpoint of the dimension serial number text to the dimension text according to the distance formula, and record the distance as d4; Similarly, the distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text is calculated according to the distance calculation formula, and is recorded as d5 and d6; The d5 is the horizontal distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text; that is, it is obtained by calculating the distance from the midpoint of the dimension serial number text to the midpoint of the tolerance text associated with the dimension text in the horizontal direction; The d6 is the vertical distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text; that is, it is obtained by calculating the distance from the midpoint of the dimension serial number text to the midpoint of the tolerance text associated with the dimension text in the vertical direction; S35: Dimension number text associated with dimension text; Note the length L1 of the dimension text, where L1 is the horizontal distance between dimension text P0 and P1. If any value among d4, d5, and d6 is smaller than the length L1 of the dimension text, the dimension serial number text is determined to be associated with the dimension text. S36: Calculate the dimension text partition position; Set the partitioning method of the PDF drawing to use Arabic numerals for horizontal partitions and uppercase letters for vertical partitions; and set the spacing to S, and the interval range of S is [25, 75]; Calculate the specific area of ​​the dimension text coordinates (Xt, Yt) in the drawing, round down the value obtained by Xt / S and add 1 to get the horizontal partition number; round down the value obtained by Yt / S and add 1 to get the number in the order of uppercase letters in the alphabet, and get the uppercase letters as the vertical partition number; confirm the partition position of the dimension text by confirming the partition position of the coordinates of each contour point of the dimension text in the PDF drawing; S37: Get title bar information; Define the position and size range of the title bar; The title bar area contains text information such as unit name, drawing number, signature column, date column, etc.; Use openpyxl component to get the text content in the title bar.

[0014] S4: Get the component size inspection table; The component size inspection table includes information such as component design dimensions, processing requirements, inspection tools, and verification results; The following sub-steps are included: S41: Calling the component dimension inspection table template; Use the copy command to copy the existing component size inspection table template to the specified directory; the component size inspection table template is an Excel file; S42: Fill in detailed data; Start the Excel application through the CreateDispatch component; Use the _Workbook component to open the component dimension inspection table template copied to the specified directory; Get all pages through Workbooks, specify the first worksheet as the operation object, get the page cells through Range, and fill the dimension text, dimension serial number text, dimension tolerance text, dimension area position, title bar information and other data obtained in step S3 into the worksheet through the SetItem method; After the operation is completed, use ReleaseDispatch to release resources and save the component size detection table; After saving, close the Excel program and exit, ensuring that the generated component dimension inspection table is correctly saved in the specified directory.

[0015] In the method of the present invention, the inspector uses the software of the present invention to select the PDF drawing function, and through the open source library PDFium, analyzes all the dimensions, tolerances, dimension numbers, and title bar information on the PDF drawing, and exports the component dimension detection table in the EXCEL format. A new component dimension detection table generation method is created. The original old mode is to manually analyze the PDF drawing dimension list, manually record the dimension number, and then record the dimension in the EXCEL table, which takes a lot of time and energy. The method of the present invention systematically simplifies the operation of the inspector, selects the PDF drawing on the software, automatically analyzes the dimension, dimension number, and directly exports the PDF drawing dimension record, without the need for manual analysis of the drawing, and without the need for manual recording of the dimension and tolerance. A PDF drawing can output all the PDF drawing dimension record tables in a few seconds; it solves the preliminary work of the inspector's inspection, allowing the inspector to focus on the work of verifying whether the parts are qualified, and improving the work efficiency of the inspector.

[0016] The present invention has been described by the above-mentioned relevant embodiments, however, the above-mentioned embodiments are only examples for implementing the present invention. It must be pointed out that the disclosed embodiments do not limit the scope of the present invention. On the contrary, changes and modifications made without departing from the spirit and scope of the present invention are all within the scope of patent protection of the present invention.

Claims

1. A method for exporting PDF drawing size, characterized by: The following steps are involved: S1: Select PDF drawing; Select the PDF drawing corresponding to the specific digital model according to actual needs; The PDF drawings are engineering drawings used by engineers to design digital models, and are two-dimensional engineering drawings associated with three-dimensional models created by three-dimensional design software; S2: Get the PDF text position; In the PDF drawing selected in step S1, the position coordinates and text content of the text information contained in the PDF drawing are obtained; The following sub-steps are included: S21: Configure and initialize the open source library PDFium; S22: Get the valid range in the PDF drawing; S23: Obtaining the contour points of the characters contained in each text within the valid range in the PDF drawing; S3: Analyze data; The following sub-steps are included: S31: Recognize dimension text; S32: Recognize tolerance text; S33: Identify the size serial number text; The dimension text obtained in step S31 is further judged. If the dimension text only contains numbers and the position of the text is within the valid range of the PDF drawing, the dimension text is judged to be dimension serial number text; otherwise, it is not dimension serial number text; S34: Dimension number text associated with dimension text; S35: Dimension number text associated with dimension text; S36: Calculate the dimension text partition position; S37: Get title bar information; Define the position and size range of the title bar; The title bar area contains text information of the unit name, drawing number, signature column, and date column; Use openpyxl component to get the text information in the title bar; S4: Get the component size inspection table; The following sub-steps are included: S41: Calling the component dimension inspection table template; S42: Fill in detailed data.

2. The method for exporting PDF drawing size according to claim 1, characterized in that: The specific contents of step S2 are as follows: S21: Configure and initialize the open source library PDFium; Configure the open source library PDFium in the project where the PDF drawings are located, and call the FPDF_InitLibrary function to load and initialize the PDFium library; the open source library PDFium contains the PDF drawings corresponding to each 3D model; S22: Get the valid range in the PDF drawing; The user selects a PDF drawing in the open source library PDFium through the choosePDFFile function, and the PDF drawing is the PDF drawing selected in step S1; Open the PDF drawing through the FPDF_LoadDocument function of the open source library PDFium, and get the number of pages of the PDF drawing through the FPDF_GetPageCount function; Further, the specified page is obtained through the FPDF_LoadPage function, and the specified text page is loaded through the FPDFText_LoadPage function; Use FPDF_GetPageSizeByIndex function to get the width and height of each page of PDF drawing; cut the width and height of the page based on the drawing frame rule to get the valid range of PDF drawing; S23: Obtaining the contour points of the characters contained in each text within the valid range in the PDF drawing; Use the FPDFText_CountChars function to get all characters in the valid range of the PDF drawing; Use FPDFText_GetCharBox to get the value of the bounding box of each character, that is, the boundary values ​​of the top, bottom, left, and right boundaries, which are recorded as top, bottom, left, and right respectively; the boundary values ​​are based on the coordinate system of the lower left corner of the PDF drawing page; According to the boundary value, calculate the four contour points of each character, record the four contour points: the upper left is P0, the upper right is P1, the lower left is P2, the lower right is P3, the character length is L1, and the character height is H1; but , , 、 ; The character length L1 = right - left, that is, the difference between the left and right boundaries, and the character height H1 = top - bottom, that is, the difference between the upper and lower boundaries.

3. The method for exporting PDF drawing size according to claim 1, characterized in that: The specific contents of step S31 are as follows: S31: Recognize dimension text; Contains the following sub-steps: S311: Calculate character spacing; According to the contour points of the characters obtained in step S2, the horizontal spacing between adjacent characters is calculated in sequence, and the calculation method is as follows: Assume that characters A and B are adjacent characters, and the character spacing between characters A and B is d1, d1 = |A.P1 - B.P0|; that is, the distance between the right point P1 of character A and the left point P0 of character B; if d1 is 0, it means that characters A and B are closely connected and there is no horizontal spacing; S312: Calculate character height; Note that the character height of character A is d2, and the character height of character B is d3; d2=|A.P3 - A.P0|, that is, the vertical distance between the contour points P3 and P0 of character A, d3=|B.P3 - B.P0|: the vertical distance between the contour points P3 and P0 of character B; S313: Determine whether the characters are a group; When two characters satisfy d1=0 and d2=d3, the two characters are considered to be a group; otherwise, they do not constitute a group of characters. For all characters, loop through steps S311-S313, calculate the spacing and height between adjacent characters in turn, and determine whether they belong to the same group, until all characters are determined; The characters in the same group form a text, and all the texts composed of the characters are obtained; S314: Determine whether it is a dimension text; It is determined in turn whether the text obtained in step S313 is a dimension text, that is, when the text does not contain any characters other than numbers or decimal points, it is a dimension text; otherwise, it is not a dimension text; Merge the contour points of all characters in the dimension text, find the leftmost point, rightmost point, topmost point, and bottommost point of all character contours, and get the 4 contour points of the text: P0, P1, P2, and P3.

4. The method for exporting PDF drawing size according to claim 1, characterized in that: The specific contents of step S32 are as follows: S32: Recognize tolerance text; Determine whether the text obtained in step S313 is a tolerance text, and the determination method includes the following sub-steps: S321: Perform symbol judgment; Check whether the text contains a "+" or "-" sign. If not, it is not a tolerance text. If it does, go to step S322. S322: Perform position determination; Use the distance formula to calculate the distance between point P0 in the text and the dimension text obtained in step S314. If the distance is 0, proceed to step S323. Otherwise, it is not a tolerance text; S323: Make a height judgment; Use the distance formula to calculate the height of the text, that is, the distance between points P3 and P0. If the distance is the height of the dimension text, that is, 1 / 2 of the distance between points P3 and P0 of the dimension text, then go to step S324; otherwise, it is not a tolerance text. S324: judging the composition of the text; If the text contains only numbers and decimal points besides the symbols "+" or "-", it is a tolerance text; otherwise it is not a tolerance text; Associate the resulting tolerance text with the corresponding dimension text.

5. The method for exporting PDF drawing size according to claim 1, characterized in that: The specific contents of step S34 are as follows: Connect the points P0 and P2 of the dimension serial number text to form a line segment P0P2. Let the midpoint of this line segment be PM=(PMx,PMy), PMx=(P0x+P2x) / 2, PMy=(P0y+P2y) / 2; Get the midpoint of the dimension serial number text according to the position of the dimension serial number text; Calculate the distance from the midpoint of the dimension serial number text to the dimension text according to the distance formula, and record the distance as d4; Similarly, the distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text is calculated according to the distance calculation formula, and is recorded as d5 and d6; The d5 is the horizontal distance between the midpoint of the dimension serial number text and the tolerance text associated with the dimension text; that is, it is obtained by calculating the distance from the midpoint of the dimension serial number text to the midpoint of the tolerance text associated with the dimension text in the horizontal direction; The d6 is the vertical distance between the midpoint of the dimension number text and the tolerance text associated with the dimension text; that is, it is obtained by calculating the distance from the midpoint of the dimension number text to the midpoint of the tolerance text associated with the dimension text in the vertical direction.

6. The method for exporting PDF drawing size as claimed in claim 5, characterized in that: The specific contents of step S35 are as follows: Note that the length of the dimension text is L1, where L1 is the horizontal distance from the dimension text P0 to P1. If any value among d4, d5, and d6 is smaller than the length of the dimension text L1, the dimension serial number text is determined to be associated with the dimension text.

7. The method for exporting PDF drawing size according to claim 1, characterized in that: The specific contents of step S36 are as follows: Set the partitioning method of the PDF drawing to use Arabic numerals for horizontal partitions and uppercase letters for vertical partitions; and set the spacing to S, and the interval range of S is [25, 75]; Calculate the specific area of ​​the dimension text coordinates (Xt, Yt) in the drawing, round down the value obtained by Xt / S and add 1 to get the horizontal partition number; round down the value obtained by Yt / S and add 1 to get the number in the order of uppercase letters in the alphabet, and get the uppercase letters as the vertical partition number; confirm the partition position of the dimension text by confirming the partition position of the coordinates of each contour point of the dimension text in the PDF drawing.

8. The method for exporting PDF drawing size according to claim 1, characterized in that: The specific contents of step S4 are as follows: S41: Calling the component dimension inspection table template; Use the copy command to copy the existing component size inspection table template to the specified directory; the component size inspection table template is an Excel file; S42: Fill in detailed data; Start the Excel application through the CreateDispatch component; Use the _Workbook component to open the component dimension inspection table template copied to the specified directory; Get all pages through Workbooks, specify the first worksheet as the operation object, get the page cells through Range, and fill the dimension text, dimension serial number text associated with the dimension, dimension tolerance text, dimension area position, and title bar information data obtained in step S3 into the worksheet through the SetItem method; After the operation is completed, use ReleaseDispatch to release resources and save the component size detection table; After saving, close the Excel program and exit, ensuring that the generated component dimension inspection table is correctly saved in the specified directory.