Récuperation données curl

La doc dit

lp -o media=Custom.WIDTHxLENGTHmm filename

Alors j'ai mis

Bloc de code:
 cupsfilter -o cpi=15 -o lpi=10 lp -o media=Custom.150x400mm RESULTATS.txt > RESULTATS.pdf 2> /dev/null
sips -s format jpeg RESULTATS.pdf --out RESULTATS.jpg 1> /dev/null

Ca genere toujours un A4, de plus le PDF produit derriere est maintenant corrompu. :)
(j'ai essayé sans mettre "lp" , -o media=Custom150x400, idem)
 
Essaye en ne mettant que l’option de taille de papier.
 
C’est sans le lp. Mais bon, ça a l’air de ne pas passer. J’essayerai chez moi pour voir.
 
@daffyb

As tu eu le temps d'essayer ?
oui, et je n'arrive pas à grand chose… il faudrait peut-être regarder en créant un fichier .ppd
Si tu enlèves la fin de la commande, tu peux avoir en sortie dans le terminal les infos de debug.
cupsfilter -o cpi=15 -o lpi=10 RESULTATS.txt > RESULTATS.pdf
Ça te permettra de trouver le ppd générique et d'essayer de l'adapter.
Je ferai un essai de mon coté aussi ;)
 
Dernière édition:
Voila ce que ca donne :

DEBUG: argv[0]="cupsfilter"
DEBUG: argv[1]="1"
DEBUG: argv[2]="xxx"
DEBUG: argv[3]="RESULTATS.txt"
DEBUG: argv[4]="1"
DEBUG: argv[5]="cpi=15 lpi=10"
DEBUG: argv[6]="RESULTATS.txt"
DEBUG: envp[0]="<CFProcessPath>"
DEBUG: envp[1]="CONTENT_TYPE=text/plain"
DEBUG: envp[2]="CUPS_DATADIR=/usr/share/cups"
DEBUG: envp[3]="CUPS_FONTPATH=/usr/share/cups/fonts"
DEBUG: envp[4]="CUPS_SERVERBIN=/usr/libexec/cups"
DEBUG: envp[5]="CUPS_SERVERROOT=/private/etc/cups"
DEBUG: envp[6]="LANG=fr_FR.UTF8"
DEBUG: envp[7]="PATH=/usr/libexec/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
DEBUG: envp[8]="PPD=/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/Resources/Generic.ppd"
DEBUG: envp[9]="PRINTER_INFO=cupsfilter"
DEBUG: envp[10]="PRINTER_LOCATION=Unknown"
DEBUG: envp[11]="PRINTER=cupsfilter"
DEBUG: envp[12]="RIP_MAX_CACHE=128m"
DEBUG: envp[13]="USER=xxx"
DEBUG: envp[14]="CHARSET=utf-8"
DEBUG: envp[15]="FINAL_CONTENT_TYPE=application/pdf"
INFO: cgtexttopdf (PID 3153) started.
DEBUG: Message catalog filename is "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/Resources/French.lproj/cups_apple.strings".
DEBUG: Page = 612x792; 17,19 to 595,773
DEBUG: No italic font!
DEBUG: No bold-italic font!
DEBUG: No bold font!
INFO: cgtexttopdf (PID 3153) exited with no errors.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
 
oui, et je n'arrive pas à grand chose… il faudrait peut-être regarder en créant un fichier .ppd
Si tu enlèves la fin de la commande, tu peux avoir en sortie dans le terminal les infos de debug.
cupsfilter -o cpi=15 -o lpi=10 RESULTATS.txt > RESULTATS.pdf
Ça te permettra de trouver le ppd générique et d'essayer de l'adapter.
Je ferai un essai de mon coté aussi ;)
ça marche en faisant un ppd custom (ou en éditant celui du system, chose que je ne te conseille pas).

Tu crées un fichier .ppd avec ce code à l'intérieur (que tu pourras alléger d'ailleurs)
Bloc de code:
*PPD-Adobe: "4.3"
*% This is the PPD for the Generic Printer in OS X
*FormatVersion: "4.3"
*FileVersion: "1.0"
*LanguageEncoding: UTF-8
*LanguageVersion: English
*PCFileName: "APGenPtr.PPD"
*Manufacturer: "Generic"
*Product: "(Generic Printer)"
*LanguageLevel: "3"
*PSVersion: "(3011.104) 0"
*ModelName: "Generic Printer"
*ShortNickName: "Generic Printer"
*NickName: "Generic Printer"
*cupsVersion:    1.1
*cupsManualCopies: True

*% The generic printer is a PDF capable printer.
*cupsFilter: "application/vnd.cups-pdf 0 -"

*DefaultResolution: 300dpi
*ColorDevice: True
*DefaultColorSpace: "RGB"

*% Paper Handling ===================
*OpenUI *PageSize: PickOne
*DefaultPageSize: Letter
*PageSize Letter/US Letter: "<</PageSize[612.00 792.00]>>setpagedevice"
*PageSize Legal/US Legal: "<</PageSize[612.00 1008.00]>>setpagedevice"
*PageSize A4/A4: "<</PageSize[595.00 842.00]>>setpagedevice"
*PageSize A5/A5: "<</PageSize[420.00 595.00]>>setpagedevice"
*PageSize B5/JIS B5: "<</PageSize[516.00 729.00]>>setpagedevice"
*PageSize ISOB5/B5: "<</PageSize[499.00 709.00]>>setpagedevice"
*PageSize Env10/Envelope #10: "<</PageSize[297.00 684.00]>>setpagedevice"
*PageSize EnvDL/Envelope DL: "<</PageSize[312.00 624.00]>>setpagedevice"
*PageSize Tabloid/Tabloid: "<</PageSize[792.00 1224.00]>>setpagedevice"
*PageSize A3/A3: "<</PageSize[842.00 1191.00]>>setpagedevice"
*PageSize ARCHB/Tabloid Oversize: "<</PageSize[864.00 1296.00]>>setpagedevice"
*PageSize roc16K/ROC 16K: "<</PageSize[558.00 774.00]>>setpagedevice"
*PageSize EnvChou3/Envelope Choukei 3: "<</PageSize[340.00 666.00]>>setpagedevice"
*PageSize 13x19/Super B<2F>A3: "<</PageSize[936.00 1368.00]>>setpagedevice"
*PageSize Custom/Perso: "<</PageSize[425.00 1133.00]>>setpagedevice"
*CloseUI: *PageSize

*OpenUI *PageRegion: PickOne
*DefaultPageRegion: Letter
*PageRegion Letter/US Letter: "<</PageSize[612.00 792.00]>>setpagedevice"
*PageRegion Legal/US Legal: "<</PageSize[612.00 1008.00]>>setpagedevice"
*PageRegion A4/A4: "<</PageSize[595.00 842.00]>>setpagedevice"
*PageRegion A5/A5: "<</PageSize[420.00 595.00]>>setpagedevice"
*PageRegion B5/JIS B5: "<</PageSize[516.00 729.00]>>setpagedevice"
*PageRegion ISOB5/B5: "<</PageSize[499.00 709.00]>>setpagedevice"
*PageRegion Env10/Envelope #10: "<</PageSize[297.00 684.00]>>setpagedevice"
*PageRegion EnvDL/Envelope DL: "<</PageSize[312.00 624.00]>>setpagedevice"
*PageRegion Tabloid/Tabloid: "<</PageSize[792.00 1224.00]>>setpagedevice"
*PageRegion A3/A3: "<</PageSize[842.00 1191.00]>>setpagedevice"
*PageRegion ARCHB/Tabloid Oversize: "<</PageSize[864.00 1296.00]>>setpagedevice"
*PageRegion roc16K/ROC 16K: "<</PageSize[558.00 774.00]>>setpagedevice"
*PageRegion EnvChou3/Envelope Choukei 3: "<</PageSize[340.00 666.00]>>setpagedevice"
*PageRegion 13x19/Super B<2F>A3: "<</PageSize[936.00 1368.00]>>setpagedevice"
*PageRegion Custom/Perso: "<</PageSize[425.00 1133.00]>>setpagedevice"
*CloseUI: *PageRegion

*DefaultImageableArea: Letter
*ImageableArea Letter/US Letter: "18.00 40.00 594.00 774.00"
*ImageableArea Legal/US Legal: "18.00 40.00 594.00 990.00"
*ImageableArea A4/A4: "18.00 41.00 577.00 824.00"
*ImageableArea A5/A5: "18.00 18.00 402.00 577.00"
*ImageableArea B5/JIS B5: "18.00 18.00 498.00 711.00"
*ImageableArea ISOB5/B5: "18.00 18.00 481.00 691.00"
*ImageableArea Env10/Envelope #10: "18.00 40.00 279.00 666.00"
*ImageableArea EnvDL/Envelope DL: "18.00 18.00 294.00 606.00"
*ImageableArea Tabloid/Tabloid: "18.00 18.00 774.00 1206.00"
*ImageableArea A3/A3: "18.00 18.00 824.00 1173.00"
*ImageableArea ARCHB/Tabloid Oversize: "18.00 18.00 846.00 1278.00"
*ImageableArea roc16K/ROC 16K: "18.00 18.00 540.00 756.00"
*ImageableArea EnvChou3/Envelope Choukei 3: "18.00 18.00 322.00 648.00"
*ImageableArea 13x19/Super B<2F>A3: "18.00 18.00 918.00 1350.00"
*ImageableArea Custom/Perso: "18.00 40.00 407.00 1093.00"

*DefaultPaperDimension: Letter
*PaperDimension Letter/US Letter: "612.00 792.00"
*PaperDimension Legal/US Legal: "612.00 1008.00"
*PaperDimension A4/A4: "595.00 842.00"
*PaperDimension A5/A5: "420.00 595.00"
*PaperDimension B5/JIS B5: "516.00 729.00"
*PaperDimension ISOB5/B5: "499.00 709.00"
*PaperDimension Env10/Envelope #10: "297.00 684.00"
*PaperDimension EnvDL/Envelope DL: "312.00 624.00"
*PaperDimension Tabloid/Tabloid: "792.00 1224.00"
*PaperDimension A3/A3: "842.00 1191.00"
*PaperDimension ARCHB/Tabloid Oversize: "864.00 1296.00"
*PaperDimension roc16K/ROC 16K: "558.00 774.00"
*PaperDimension EnvChou3/Envelope Choukei 3: "340.00 666.00"
*PaperDimension 13x19/Super B<2F>A3: "936.00 1368.00"
*PaperDimension Custom/Perso: "425.00 1133.00"
*DefaultOutputOrder: Reverse

*% Custom page size attributes
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 0 999999
*ParamCustomPageSize Height: 2 points 0 999999
*ParamCustomPageSize WidthOffset: 3 points 0.00 0.00
*ParamCustomPageSize HeightOffset: 4 points 0.00 0.00
*ParamCustomPageSize Orientation: 5 int 0 0
*CustomPageRegion True: ""
*MaxMediaWidth: "0"
*MaxMediaHeight: "999999"

*CenterRegistered: False

*% margins of 0.25 inches.
*HWMargins: 18 18 18 18

*DefaultFont: Courier
*Font Courier: Standard "(004.000)" Standard Disk

Tu noteras, que tu peux changer les marges...
à toi de voir.
Toutes les lignes avec Custom/Perso, sont celles que j'ai ajoutées pour sortir en 150x400 (environ).
Tu appelles le .ppd dans la ligne de commande et tu passes le paramètre de taille de papier comme ça :
Bloc de code:
cupsfilter -P ./Mon.ppd -o media=Custom -o cpi=15 -o lpi=10 RESULTATS.txt > RESULTATS.pdf

Je te laisse adapter, et j'attends ton retour ;)
 
Dernière édition: