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