Add PDF writer.
This commit is contained in:
parent
c05b7b6315
commit
9c116b1efd
72 changed files with 1819 additions and 114 deletions
58
src/publishing/pdf/PdfObject.cpp
Normal file
58
src/publishing/pdf/PdfObject.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
#include "PdfObject.h"
|
||||
|
||||
#include "PdfDictionary.h"
|
||||
#include "PdfXRefTable.h"
|
||||
|
||||
std::string PdfObject::ToString(PdfXRefTable* xRefTable)
|
||||
{
|
||||
UpdateDictionary();
|
||||
|
||||
auto content = GetStringPrefix();
|
||||
content += mDictionary.ToString();
|
||||
content += GetStringSuffix();
|
||||
|
||||
xRefTable->AddRecord(content.size(), mGenerationNumber, mIsFree);
|
||||
return content;
|
||||
}
|
||||
|
||||
void PdfObject::UpdateDictionary()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string PdfObject::GetStringSuffix() const
|
||||
{
|
||||
return "endobj\n\n";
|
||||
}
|
||||
|
||||
unsigned PdfObject::IndexObjects(unsigned count)
|
||||
{
|
||||
const auto newCount = count + 1;
|
||||
mObjectNumber = newCount;
|
||||
return newCount;
|
||||
}
|
||||
|
||||
void PdfObject::SetObjectNumber(unsigned num)
|
||||
{
|
||||
mObjectNumber = num;
|
||||
}
|
||||
|
||||
void PdfObject::SetGenerationNumber(unsigned num)
|
||||
{
|
||||
mGenerationNumber = num;
|
||||
}
|
||||
|
||||
std::string PdfObject::GetStringPrefix() const
|
||||
{
|
||||
return std::to_string(mObjectNumber) + " " + std::to_string(mGenerationNumber) + " obj\n";
|
||||
}
|
||||
|
||||
std::string PdfObject::GetRefString() const
|
||||
{
|
||||
return std::to_string(mObjectNumber) + " " + std::to_string(mGenerationNumber) + " R";
|
||||
}
|
||||
|
||||
bool PdfObject::IsFree() const
|
||||
{
|
||||
return mIsFree;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue