altmany / export_fig

A MATLAB toolbox for exporting publication quality figures
BSD 3-Clause "New" or "Revised" License
1.27k stars 365 forks source link

appending on pdf is failing #339

Closed pawanshirur closed 3 years ago

pawanshirur commented 3 years ago

when trying to append to a pdf i get the following error. ( this code was working in previous version of ghostscript and export_fig)

hostscript error: undefinedfilename in (C:\Users\pshirur\AppData\Local\Temp\tp0821223f_00a5_45d6_be68_84d7995ca24c.pdf)

Ghostscript path: C:\Program Files\gs\gs9.54.0\bin\gswin64c.exe Ghostscript options: -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="C:\Users\pshirur\AppData\Local\Temp\tpf97e812c_4b46_49a4_b8ba_a4226b0239a5.pdf" -dEPSCrop -sFONTPATH="C:\WINDOWS\Fonts" -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/DCTEncode -dGrayImageFilter=/DCTEncode -c ".setpdfwrite << /ColorImageDict << /QFactor 0.20 /Blend 1 /HSample [1 1 1 1] /VSample [1 1 1 1] >> /GrayImageDict << /QFactor 0.20 /Blend 1 /HSample [1 1 1 1] /VSample [1 1 1 1] >> >> setdistillerparams" -f "C:\Users\pshirur\AppData\Local\Temp\tp0821223f_00a5_45d6_be68_84d7995ca24c.pdf" "C:\Users\pshirur\AppData\Local\Temp\tp9027182c_c40f_4591_8f6f_3e45c5ffd655.pdf"

Please ensure:

If the problem persists, then please report a new issue. In your report, please upload the problematic EPS file: C:\Users\pshirur\AppData\Local\Temp\tp2c4965bc_5270_4a40_9b35_4e005db950d1.eps (you can then delete this file).

Error using eps2pdf (line 231) Error: /undefinedfilename in (C:\Users\pshirur\AppData\Local\Temp\tp0821223f_00a5_45d6_be68_84d7995ca24c.pdf) Operand stack:

Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push Dictionary stack: --dict:735/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)-- Current allocation mode is local Last OS error: No such file or directory GPL Ghostscript 9.54.0: Unrecoverable error, exit code 1

Error in export_fig (line 918) eps2pdf(tmp_nam, pdf_nam_tmp, 1, options.append, options.colourspace==2, options.quality, options.gs_options);

Error in LRG4P_CAN_OVEN_Test_V2_20201103>play_Callback (line 963) export_fig(sprintf('%s',rpt), '-a1','-append','-pdf', '-tif', '-q80');

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in LRG4P_CAN_OVEN_Test_V2_20201103 (line 42) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)LRG4P_CAN_OVEN_Test_V2_20201103('play_Callback',hObject,eventdata,guidata(hObject))

altmany commented 3 years ago

Did you follow the instructions in the detailed error message? Namely, did you ensure that you are not trying to append to a PDF file that is already in use and that you do not have another Ghostscript installed in your system's path? Also, you did not follow the specific instruction to upload the problematic EPS file. Without any additional information, it is impossible to recreate the error, sorry

p.s. in your call to export_fig, sprintf('%s',rpt) is exactly the same as simply rpt, there's no need to complicate things.

altmany commented 3 years ago

The latest commit includes a workaround for some problems involving PDF append - I have no idea whether or not it resolves your specific problem above, because as I already mentioned you did not provide enough information in your original post.