mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 10:55:04 +08:00
remove islenientparsing from contentstreamprocessor
This commit is contained in:
@@ -43,7 +43,6 @@
|
||||
private readonly IResourceStore resourceStore;
|
||||
private readonly UserSpaceUnit userSpaceUnit;
|
||||
private readonly PageRotationDegrees rotation;
|
||||
private readonly bool isLenientParsing;
|
||||
private readonly IPdfTokenScanner pdfScanner;
|
||||
private readonly IPageContentParser pageContentParser;
|
||||
private readonly IFilterProvider filterProvider;
|
||||
@@ -82,7 +81,6 @@
|
||||
};
|
||||
|
||||
public ContentStreamProcessor(PdfRectangle cropBox, IResourceStore resourceStore, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation,
|
||||
bool isLenientParsing,
|
||||
IPdfTokenScanner pdfScanner,
|
||||
IPageContentParser pageContentParser,
|
||||
IFilterProvider filterProvider,
|
||||
@@ -91,7 +89,6 @@
|
||||
this.resourceStore = resourceStore;
|
||||
this.userSpaceUnit = userSpaceUnit;
|
||||
this.rotation = rotation;
|
||||
this.isLenientParsing = isLenientParsing;
|
||||
this.pdfScanner = pdfScanner ?? throw new ArgumentNullException(nameof(pdfScanner));
|
||||
this.pageContentParser = pageContentParser ?? throw new ArgumentNullException(nameof(pageContentParser));
|
||||
this.filterProvider = filterProvider ?? throw new ArgumentNullException(nameof(filterProvider));
|
||||
@@ -490,9 +487,9 @@
|
||||
|
||||
public void BeginInlineImage()
|
||||
{
|
||||
if (inlineImageBuilder != null && !isLenientParsing)
|
||||
if (inlineImageBuilder != null)
|
||||
{
|
||||
throw new PdfDocumentFormatException("Begin inline image (BI) command encountered while another inline image was active.");
|
||||
log?.Error("Begin inline image (BI) command encountered while another inline image was active.");
|
||||
}
|
||||
|
||||
inlineImageBuilder = new InlineImageBuilder();
|
||||
@@ -502,12 +499,8 @@
|
||||
{
|
||||
if (inlineImageBuilder == null)
|
||||
{
|
||||
if (isLenientParsing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
throw new PdfDocumentFormatException("Begin inline image data (ID) command encountered without a corresponding begin inline image (BI) command.");
|
||||
log?.Error("Begin inline image data (ID) command encountered without a corresponding begin inline image (BI) command.");
|
||||
return;
|
||||
}
|
||||
|
||||
inlineImageBuilder.Properties = properties;
|
||||
@@ -517,12 +510,8 @@
|
||||
{
|
||||
if (inlineImageBuilder == null)
|
||||
{
|
||||
if (isLenientParsing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
throw new PdfDocumentFormatException("End inline image (EI) command encountered without a corresponding begin inline image (BI) command.");
|
||||
log?.Error("End inline image (EI) command encountered without a corresponding begin inline image (BI) command.");
|
||||
return;
|
||||
}
|
||||
|
||||
inlineImageBuilder.Bytes = bytes;
|
||||
|
@@ -109,7 +109,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
content = GetContent(number, bytes, cropBox, userSpaceUnit, rotation, isLenientParsing);
|
||||
content = GetContent(number, bytes, cropBox, userSpaceUnit, rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
var bytes = contentStream.Decode(filterProvider);
|
||||
|
||||
content = GetContent(number, bytes, cropBox, userSpaceUnit, rotation, isLenientParsing);
|
||||
content = GetContent(number, bytes, cropBox, userSpaceUnit, rotation);
|
||||
}
|
||||
|
||||
var page = new Page(number, dictionary, mediaBox, cropBox, rotation, content,
|
||||
@@ -138,13 +138,12 @@
|
||||
}
|
||||
|
||||
private PageContent GetContent(int pageNumber, IReadOnlyList<byte> contentBytes, CropBox cropBox, UserSpaceUnit userSpaceUnit,
|
||||
PageRotationDegrees rotation,
|
||||
bool isLenientParsing)
|
||||
PageRotationDegrees rotation)
|
||||
{
|
||||
var operations = pageContentParser.Parse(pageNumber, new ByteArrayInputBytes(contentBytes),
|
||||
log);
|
||||
|
||||
var context = new ContentStreamProcessor(cropBox.Bounds, resourceStore, userSpaceUnit, rotation, isLenientParsing, pdfScanner,
|
||||
var context = new ContentStreamProcessor(cropBox.Bounds, resourceStore, userSpaceUnit, rotation, pdfScanner,
|
||||
pageContentParser,
|
||||
filterProvider,
|
||||
log);
|
||||
|
Reference in New Issue
Block a user