Spire.PDF 9.7.0 supports creating labeled PDF files containing structured tables

2023-07-03 09:53:55

We are happy to announce the release of Spire.PDF 9.7.0. This version adds the supports for zoom level in fitting height and creating labeled PDF files containing structured tables. It also enhances the conversion from PDF to PDF/A3A and PDF/A1B. What’s more, some known issues are fixed in this version, such as the issue that the stamp rotated out of shape when printing PDF. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPDF-5964 Supports creating labeled PDF files containing structured tables.
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins(20));
page.SetTabOrder(TabOrder.Structure);
PdfTaggedContent taggedContent = new PdfTaggedContent(doc);
taggedContent.SetLanguage("en-US");
taggedContent.SetTitle("test");
taggedContent.SetPdfUA1Identification();
PdfTrueTypeFont font = new PdfTrueTypeFont(new System.Drawing.Font("Times New Roman", 14), true);
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfStructureElement document = taggedContent.StructureTreeRoot.AppendChildElement(PdfStandardStructTypes.Document);
PdfStructureElement heading1 = document.AppendChildElement(PdfStandardStructTypes.HeadingLevel1);
heading1.BeginMarkedContent(page);
string headingText = "What is a Tagged PDF?";
page.Canvas.DrawString(headingText, font, brush, new PointF(0, 0));
heading1.EndMarkedContent(page);
PdfStructureElement paragraph = document.AppendChildElement(PdfStandardStructTypes.Paragraph);
paragraph.BeginMarkedContent(page);
string paragraphText = ""Tagged PDF" doesn’t seem like a life-changing term. But for some, it is. For people who are " +
    "blind or have low vision and use assistive technology (such as screen readers and connected Braille displays) to " +
    "access information, an untagged PDF means they are missing out on information contained in the document because assistive " +
    "technology cannot "read" untagged PDFs.  Digital accessibility has opened up so many avenues to information that were once " +
    "closed to people with visual disabilities, but PDFs often get left out of the equation.";
RectangleF rect = new RectangleF(0, 30, page.Canvas.ClientSize.Width, page.Canvas.ClientSize.Height);
page.Canvas.DrawString(paragraphText, font, brush, rect);
paragraph.EndMarkedContent(page);
PdfStructureElement figure = document.AppendChildElement(PdfStandardStructTypes.Figure);
figure.BeginMarkedContent(page);
PdfImage image = PdfImage.FromFile(TestUtil.DataPath + "ImgFiles/Bug_3938.png");
page.Canvas.DrawImage(image, new PointF(0, 150));
figure.EndMarkedContent(page);

PdfStructureElement table = document.AppendChildElement(PdfStandardStructTypes.Table);
PdfTable pdfTable = new PdfTable();
pdfTable.Style.DefaultStyle.Font = font;
System.Data.DataTable dataTable = new System.Data.DataTable();
dataTable.Columns.Add("Name");
dataTable.Columns.Add("Age");
dataTable.Columns.Add("Sex");
dataTable.Rows.Add(new string[] { "John", "22", "Male" });
dataTable.Rows.Add(new string[] { "Katty", "25", "Female" });
pdfTable.DataSource = dataTable;
pdfTable.Style.ShowHeader = true;
pdfTable.StructureElement = table;
pdfTable.Draw(page.Canvas, new PointF(0, 280), 300f);

doc.SaveToFile("1.pdf");
doc.Dispose();
New feature SPIREPDF-6038 Adds support for zoom level in fitting height.
PdfDocument myPdf = new PdfDocument("test.pdf");
PdfPageBase page = myPdf .Pages[0];
PdfDestination dest = new PdfDestination(page, new PointF(-40f, -40f));
dest.Mode = PdfDestinationMode.FitV; 
PdfGoToAction gotoaction = new PdfGoToAction(dest);
myPdf.AfterOpenAction = gotoaction;
myPdf.ViewerPreferences.PageMode = PdfPageMode.UseOutlines;
myPdf.SaveToFile("FitBH.pdf");
myPdf.Close(); 
Bug SPIREPDF-6011 Fixed the issue that an error System.NullReferenceException occurred when converting PDF to PDFA3A.
Bug SPIREPDF-6032 Fixed the issue that the content was incorrect when converting PDF to PDFA1B.
Bug SPIREPDF-6047 Fixed the issue that font changed when converting PDF to image and printing PDF.
Bug SPIREPDF-6051 Fixed the issue that an error System.NullReferenceException occurred when extracting page text.
Bug SPIREPDF-6076 Fixes the issue that stamps distorted out of shape when printing PDF.
Click the link to download Spire.PDF 9.7.0:
More information of Spire.PDF new release or hotfix: