Loading...
Searching...
No Matches
SDFDoc.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3// Consult legal.txt regarding legal and license information.
4//---------------------------------------------------------------------------------------
5#ifndef PDFTRON_H_CPPSDFSDFDoc
6#define PDFTRON_H_CPPSDFSDFDoc
7
8#include <Common/Matrix2D.h>
10#include <vector>
11
12namespace pdftron {
13 namespace Common {
14 struct ProgressMonitor;
15 }
16
17 namespace SDF {
18
19
20// forward declarations
21class Obj;
22class SecurityHandler;
23
67class SDFDoc
68{
69public:
70
78
87 SDFDoc (const UString& filepath);
88 SDFDoc (const char* filepath);
89
105
119 SDFDoc (unsigned char* buf, size_t buf_size);
120
125
129 void Close();
130
135
162#ifndef SWIG
163 void* custom_data = 0
164#endif
165 );
166
199 bool InitStdSecurityHandler (const char* password, int password_sz);
200
228
255 bool InitStdSecurityHandler(const std::vector<UInt8>& password_buf);
256
260 bool IsModified () const;
261
273 bool HasRepairedXRef() const;
274
278 bool IsFullSaveRequired () const;
279
285
291 Obj GetObj (const UInt32 obj_num) const;
292
307 Obj ImportObj (Obj obj, bool deep_copy);
308
323 std::vector<Obj> ImportObjs(const std::vector<Obj>& obj_list);
324
340 std::vector<Obj> ImportObjs(const std::vector<Obj>& obj_list, const std::vector<Obj>& exclude_list);
341
345 UInt32 XRefSize () const;
346
350 void ClearMarks ();
351
353 {
354 e_incremental = 0x01, // Save the document using incremental mode.
355 e_remove_unused = 0x02, // Remove unused objects. Requires full save.
356 e_hex_strings = 0x04, // Save all string in hexadecimal format.
357 e_omit_xref = 0x08, // Do not save cross-reference table
358 e_linearized = 0x10, // Save the document in linearized (fast web-view) format. Requires full save.
359 e_compatibility = 0x20 // Save the document in a manner that maximizes compatibility with older PDF consumers (e.g. the file will not use compressed object and xref streams).
360 };
361
362#ifndef SWIG
388 void Save(const UString& path, UInt32 flags, Common::ProgressMonitor* progress, const char* header);
389#endif
390
415 void Save(const UString& path, UInt32 flags, const char* header);
416
431 std::vector<unsigned char> Save(UInt32 flags, const char* header);
432
433#ifndef SWIG
451 void Save(const char* &out_buf, size_t& out_buf_size, UInt32 flags, Common::ProgressMonitor* progress, const char* header);
452#endif
453
466 void Save(Filters::Filter stream, UInt32 flags, const char* header);
467
476 const char* GetHeader() const;
477
493
506
511
528 void Swap(UInt32 obj_num1, UInt32 obj_num2);
529
539 Obj CreateIndirectName(const char* name);
564
569 Obj CreateIndirectStream(const char* data, const size_t data_size, Filters::Filter filter_chain =Filters::Filter());
570
571
591 bool IsLinearized() const;
592
600
608
614 void Lock();
615
619 void Unlock();
620
626 bool TryLock( int milliseconds = 0 );
627
638 void LockRead();
639
644
650 bool TryLockRead( int milliseconds = 0 );
651
658
665 void EnableDiskCaching( bool use_cache_flag );
666
667
668 //for xamarin use only
669 static SDFDoc* CreateInternal(ptrdiff_t impl);
670 ptrdiff_t GetHandleInternal();
671
672 // @cond PRIVATE_DOC
673 #ifndef SWIGHIDDEN
674 SDFDoc(TRN_SDFDoc doc) : mp_doc(doc) {}
675 TRN_SDFDoc mp_doc;
676private:
677 SDFDoc(SDFDoc& other);
678 SDFDoc& operator=(SDFDoc& other);
679 #endif
680 // @endcond
681};
682
683
684 }; // namespace SDF
685}; // namespace pdftron
686
687
688#include <Impl/SDFDoc.inl>
689
690#endif // PDFTRON_H_CPPSDFSDFDoc
SDFDoc(unsigned char *buf, size_t buf_size)
void EnableDiskCaching(bool use_cache_flag)
SDFDoc(const char *filepath)
std::vector< unsigned char > Save(UInt32 flags, const char *header)
void Save(const UString &path, UInt32 flags, Common::ProgressMonitor *progress, const char *header)
SDF::Obj GetLinearizationDict() const
bool InitStdSecurityHandler(const char *password, int password_sz)
void SetSecurityHandler(SecurityHandler handler)
Obj ImportObj(Obj obj, bool deep_copy)
bool InitSecurityHandler(void *custom_data=0)
SDF::Obj GetHintStream() const
bool TryLockRead(int milliseconds=0)
UInt32 XRefSize() const
bool InitStdSecurityHandler(const std::vector< UInt8 > &password_buf)
bool IsFullSaveRequired() const
ptrdiff_t GetHandleInternal()
static SDFDoc * CreateInternal(ptrdiff_t impl)
const char * GetHeader() const
bool InitStdSecurityHandler(const pdftron::UString &password)
Obj CreateIndirectBool(bool value)
SDFDoc(Filters::Filter stream)
Obj CreateIndirectString(const UChar *value, UInt32 size)
Obj CreateIndirectName(const char *name)
void Save(const char *&out_buf, size_t &out_buf_size, UInt32 flags, Common::ProgressMonitor *progress, const char *header)
SDFDoc(const UString &filepath)
bool HasRepairedXRef() const
void Save(const UString &path, UInt32 flags, const char *header)
Obj CreateIndirectStream(const char *data, const size_t data_size, Filters::Filter filter_chain=Filters::Filter())
Obj CreateIndirectString(const UString &str)
bool IsModified() const
bool TryLock(int milliseconds=0)
std::vector< Obj > ImportObjs(const std::vector< Obj > &obj_list, const std::vector< Obj > &exclude_list)
SecurityHandler GetSecurityHandler()
Obj CreateIndirectStream(Filters::FilterReader &data, Filters::Filter filter_chain=Filters::Filter())
void Swap(UInt32 obj_num1, UInt32 obj_num2)
void Save(Filters::Filter stream, UInt32 flags, const char *header)
UString GetFileName() const
Obj CreateIndirectNumber(double value)
bool IsLinearized() const
std::vector< Obj > ImportObjs(const std::vector< Obj > &obj_list)
Obj GetObj(const UInt32 obj_num) const
TRN_UInt32 UInt32
Definition BasicTypes.h:13
TRN_UChar UChar
Definition BasicTypes.h:12