临时资源目录改为.cache
This commit is contained in:
parent
2cfa0ec4af
commit
b042283ebb
|
|
@ -7,7 +7,7 @@ public
|
||||||
|
|
||||||
function GetCurrentPage(): PdfPage;
|
function GetCurrentPage(): PdfPage;
|
||||||
function GetCurrentPoint(): Point;
|
function GetCurrentPoint(): Point;
|
||||||
function GetTempPath(image_path: string): string;
|
function GetCachePath(image_path: string): string;
|
||||||
function GetPdf(): PdfFile;
|
function GetPdf(): PdfFile;
|
||||||
function GetNextPage(page: PdfPage): PdfPage;
|
function GetNextPage(page: PdfPage): PdfPage;
|
||||||
function AddPage(sect_ware: TSSectWare): PdfPage;
|
function AddPage(sect_ware: TSSectWare): PdfPage;
|
||||||
|
|
@ -17,7 +17,7 @@ public
|
||||||
|
|
||||||
private
|
private
|
||||||
function InitDocxComponents(alias: string; file: string);
|
function InitDocxComponents(alias: string; file: string);
|
||||||
function InitTempPath(file: string);
|
function InitCachePath(file: string);
|
||||||
function InitPdfEncoder();
|
function InitPdfEncoder();
|
||||||
function InitSectWare();
|
function InitSectWare();
|
||||||
function AllocateElementsToSectWare();
|
function AllocateElementsToSectWare();
|
||||||
|
|
@ -31,7 +31,7 @@ private
|
||||||
private
|
private
|
||||||
pdf_: PdfFile;
|
pdf_: PdfFile;
|
||||||
docx_components_: Components; // Components@DOCX
|
docx_components_: Components; // Components@DOCX
|
||||||
temp_path_: string; // 临时目录,用来存放临时文件
|
cache_path_: string; // 临时目录,用来存放临时文件
|
||||||
sect_ware_array_: array of TSSectWare; // 页面布局组件数组
|
sect_ware_array_: array of TSSectWare; // 页面布局组件数组
|
||||||
font_ware_: TSFontWare; // 字体部件
|
font_ware_: TSFontWare; // 字体部件
|
||||||
current_page_: PdfPage;
|
current_page_: PdfPage;
|
||||||
|
|
@ -45,7 +45,7 @@ begin
|
||||||
pdf_ := new PdfFile();
|
pdf_ := new PdfFile();
|
||||||
self.InitPdfEncoder();
|
self.InitPdfEncoder();
|
||||||
self.InitDocxComponents(alias, file);
|
self.InitDocxComponents(alias, file);
|
||||||
self.InitTempPath(file);
|
self.InitCachePath(file);
|
||||||
self.InitSectWare();
|
self.InitSectWare();
|
||||||
font_ware_ := new TSFontWare(pdf_);
|
font_ware_ := new TSFontWare(pdf_);
|
||||||
current_page_ := nil;
|
current_page_ := nil;
|
||||||
|
|
@ -56,7 +56,7 @@ end;
|
||||||
|
|
||||||
function TSDocxToPdf.Destroy();
|
function TSDocxToPdf.Destroy();
|
||||||
begin
|
begin
|
||||||
removeDir("", temp_path_);
|
removeDir("", cache_path_);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSDocxToPdf.SaveToFile(alias: string; file: string): integer;
|
function TSDocxToPdf.SaveToFile(alias: string; file: string): integer;
|
||||||
|
|
@ -93,9 +93,9 @@ begin
|
||||||
return point_;
|
return point_;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSDocxToPdf.GetTempPath(image_path: string): string;
|
function TSDocxToPdf.GetCachePath(image_path: string): string;
|
||||||
begin
|
begin
|
||||||
return temp_path_ + extractFileName(image_path);
|
return cache_path_ + extractFileName(image_path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSDocxToPdf.GetPdf(): PdfFile;
|
function TSDocxToPdf.GetPdf(): PdfFile;
|
||||||
|
|
@ -123,11 +123,11 @@ begin
|
||||||
if err then raise "Create obejct 'TSDocxFile' failed.";
|
if err then raise "Create obejct 'TSDocxFile' failed.";
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSDocxToPdf.InitTempPath(file: string);
|
function TSDocxToPdf.InitCachePath(file: string);
|
||||||
begin
|
begin
|
||||||
path := format("%s_%s", extractFileName(file), formatDatetime("YYYYMMDDHHNNSSZZZ", now()));
|
path := format("%s_%s", extractFileName(file), formatDatetime("YYYYMMDDHHNNSSZZZ", now()));
|
||||||
temp_path_ := format("%s/funcext/WordToPdf/temp/%s/", extractFileDir(sysExecName()), path);
|
cache_path_ := format("%s/funcext/PdfConverter/.cache/%s/", extractFileDir(sysExecName()), path);
|
||||||
createDir("", temp_path_);
|
createDir("", cache_path_);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSDocxToPdf.InitSectWare();
|
function TSDocxToPdf.InitSectWare();
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ begin
|
||||||
image_path := "word/" + rel.Target;
|
image_path := "word/" + rel.Target;
|
||||||
image := docx_components_.Zip().Get(image_path);
|
image := docx_components_.Zip().Get(image_path);
|
||||||
data := image.Data();
|
data := image.Data();
|
||||||
image_path := docx_to_pdf_.GetTempPath(image_path);
|
image_path := docx_to_pdf_.GetCachePath(image_path);
|
||||||
writeFile(rwBinary(), "", image_path, 0, length(data)-1, data);
|
writeFile(rwBinary(), "", image_path, 0, length(data)-1, data);
|
||||||
image := nil;
|
image := nil;
|
||||||
case self.GetImageFileType(data) of
|
case self.GetImageFileType(data) of
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue