2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Combine PCLm header into writeHeader

This commit is contained in:
Jay Berkenbilt 2017-08-21 20:17:47 -04:00
parent f08ce00e62
commit 9f60a864a0
2 changed files with 12 additions and 24 deletions

View File

@ -431,7 +431,6 @@ class QPDFWriter
void enqueuePart(std::vector<QPDFObjectHandle>& part);
void writeEncryptionDictionary();
void writeHeader();
void writePCLmHeader();
void writeHintStream(int hint_id);
qpdf_offset_t writeXRefTable(
trailer_e which, int first, int last, int size);

View File

@ -2514,9 +2514,17 @@ QPDFWriter::writeHeader()
writeString("%PDF-");
writeString(this->final_pdf_version);
// This string of binary characters would not be valid UTF-8, so
// it really should be treated as binary.
writeString("\n%\xbf\xf7\xa2\xfe\n");
if (this->pclm)
{
// PCLm version
writeString("\n%PCLm 1.0\n");
}
else
{
// This string of binary characters would not be valid UTF-8, so
// it really should be treated as binary.
writeString("\n%\xbf\xf7\xa2\xfe\n");
}
writeStringQDF("%QDF-1.0\n\n");
// Note: do not write extra header text here. Linearized PDFs
@ -2526,25 +2534,6 @@ QPDFWriter::writeHeader()
// linearization parameter dictionary.
}
void
QPDFWriter::writePCLmHeader()
{
setMinimumPDFVersion(pdf.getPDFVersion(), pdf.getExtensionLevel());
this->final_pdf_version = this->min_pdf_version;
this->final_extension_level = this->min_extension_level;
if (! this->forced_pdf_version.empty())
{
this->final_pdf_version = this->forced_pdf_version;
this->final_extension_level = this->forced_extension_level;
}
writeString("%PDF-");
writeString(this->final_pdf_version);
// PCLm version
writeString("\n%PCLm 1.0\n");
writeStringQDF("%QDF-1.0\n\n");
}
void
QPDFWriter::writeHintStream(int hint_id)
{
@ -3260,7 +3249,7 @@ QPDFWriter::writePCLm()
// Start writing
writePCLmHeader();
writeHeader();
writeString(this->extra_header_text);
// Image transform stream content for page strip images.