Skip to content

Commit

Permalink
implement no-includedocproperties flag (tobya#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobya authored Feb 20, 2022
1 parent 23c3ac4 commit 2aadc37
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/MainUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ TDocumentConverter = class
FOutputIsStdOut: Boolean;
fExportMarkup: integer;
FOfficeAppName: String;
FIncludeDocProps: boolean;


procedure SetCompatibilityMode(const Value: Integer);
Expand All @@ -84,6 +85,7 @@ TDocumentConverter = class
procedure LogMainHelp;
procedure SetOutputIsStdOut(const Value: Boolean);
function getIsVisio: Boolean;
procedure SetIncludeDocProps(const Value: boolean);


protected
Expand Down Expand Up @@ -175,6 +177,7 @@ TDocumentConverter = class
property useISO190051 : boolean read FuseISO190051;
property pdfOptimizeFor : integer read fpdfOptimizeFor write fpdfOptimizeFor;
property ExportMarkup : integer read fExportMarkup;
property IncludeDocProps : boolean read FIncludeDocProps write SetIncludeDocProps;
property WordConstants : TResourceStrings read getWordConstants;
property OfficeAppName : String read FOfficeAppName write FOfficeAppName;

Expand Down Expand Up @@ -495,6 +498,7 @@ constructor TDocumentConverter.Create;
FPDFPrintFromPage := 1;
FPDFPrintTopage := -1;
FuseISO190051 := false;
FIncludeDocProps := true;

FInputFiles := TStringList.Create;
end;
Expand Down Expand Up @@ -1212,6 +1216,12 @@ procedure TDocumentConverter.LoadConfig(Params: TStrings);
HaltWithConfigError(205,'Invalid value for --EXPORTMARKUP :' + value);
end;
end
else if (id = '--NO-INCLUDEDOCPROPERTIES')
OR (id = '--NO-DOCPROP') then
begin
FIncludeDocProps := false;
dec(iParam);
end
else if (id = '-W') or
(id = '--WEBHOOK') then
begin
Expand Down Expand Up @@ -1602,6 +1612,11 @@ procedure TDocumentConverter.SetList_ErrorDocs_Seconds(const Value: Integer);
FList_ErrorDocs_Seconds := Value;
end;

procedure TDocumentConverter.SetIncludeDocProps(const Value: boolean);
begin
FIncludeDocProps := Value;
end;

procedure TDocumentConverter.SetInputFile(const Value: String);
begin
FInputFile := Value;
Expand Down
2 changes: 1 addition & 1 deletion src/WordUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function TWordDocConverter.ExecuteConversion(fileToConvert: String; OutputFilena
pdfPrintFromPage,// From:=1,
pdfprintTopage,// To:=1, _
ExportMarkup,// Item:=
True,// IncludeDocProps:=True,
IncludeDocProps,// IncludeDocProps:=True,
true,// KeepIRM:=True, _
BookmarkSource,// CreateBookmarks
true,// DocStructureTags:=True, _
Expand Down
Binary file modified src/docto.res
Binary file not shown.
3 changes: 3 additions & 0 deletions src/res/HelpLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Long Parameters:
--no-subdirs Only convert specified directory. Do not recurse sub directories
--ExportMarkup Value for wdExportItem - default wdExportDocumentContent.
use wdExportDocumentWithMarkup to export all word comments with pdf
--no-IncludeDocProperties
--no-DocProp
Do not include Document Properties in the exported file.
--PDF-OpenAfterExport
If you wish for a converted PDF to be opened after creation. No value req.
--PDF-FromPage
Expand Down
4 changes: 4 additions & 0 deletions test/test_DocProp.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
REM Try optimize options on large file.
"../exe/docto.exe" -f ".\Inputfiles\GEOCADx (1).docx" -o ".\GeneratedFiles\GEOCADx_OptimizedforPrint_NoProps.pdf" -T wdFormatPDF --no-INCLUDEDOCPROPERTIES --PDF-OptimizeFor forPrint -l 10
"../exe/docto.exe" -f ".\Inputfiles\GEOCADx (1).docx" -o ".\GeneratedFiles\GEOCADx_OptimizedforPrint_NoProps2.pdf" -T wdFormatPDF --no-docprop --PDF-OptimizeFor forPrint -l 10

0 comments on commit 2aadc37

Please sign in to comment.