ps_include_file
(PECL ps:1.3.4-1.3.5)
ps_include_file — Reads an external file with raw PostScript code
Описание
bool ps_include_file
( resource $psdoc
, string $file
)
Внимание
К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.
Возвращаемые значения
Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Генерация нетекстовых MIME форматов
- Создание документов PostScript
- ps_add_bookmark
- ps_add_launchlink
- ps_add_locallink
- ps_add_note
- ps_add_pdflink
- ps_add_weblink
- ps_arc
- ps_arcn
- ps_begin_page
- ps_begin_pattern
- ps_begin_template
- ps_circle
- ps_clip
- ps_close_image
- ps_close
- ps_closepath_stroke
- ps_closepath
- ps_continue_text
- ps_curveto
- ps_delete
- ps_end_page
- ps_end_pattern
- ps_end_template
- ps_fill_stroke
- ps_fill
- ps_findfont
- ps_get_buffer
- ps_get_parameter
- ps_get_value
- ps_hyphenate
- ps_include_file
- ps_lineto
- ps_makespotcolor
- ps_moveto
- ps_new
- ps_open_file
- ps_open_image_file
- ps_open_image
- ps_open_memory_image
- ps_place_image
- ps_rect
- ps_restore
- ps_rotate
- ps_save
- ps_scale
- ps_set_border_color
- ps_set_border_dash
- ps_set_border_style
- ps_set_info
- ps_set_parameter
- ps_set_text_pos
- ps_set_value
- ps_setcolor
- ps_setdash
- ps_setflat
- ps_setfont
- ps_setgray
- ps_setlinecap
- ps_setlinejoin
- ps_setlinewidth
- ps_setmiterlimit
- ps_setoverprintmode
- ps_setpolydash
- ps_shading_pattern
- ps_shading
- ps_shfill
- ps_show_boxed
- ps_show_xy2
- ps_show_xy
- ps_show2
- ps_show
- ps_string_geometry
- ps_stringwidth
- ps_stroke
- ps_symbol_name
- ps_symbol_width
- ps_symbol
- ps_translate
Коментарии
This method allows you to insert raw postscript at any point in the postscript document.
You can use this function to include 'Barcodes in pure PostScript' in the prolog of your postscript document, and then create a temporary file that contains the necessary postscript to actually call the barcode generating postscript function at whatever point in your document you want it to appear.
it would be nice if there was an alternate form of this function that allowed you to just insert the raw postscript other than make a temporary file to be opened by the function.
I wanted to print to a specific tray of my printer, a Dell 3110cn. Some printers allow you to specify in their config what tray will be used as a default tray, but my printer doesn't. Googling told me that printing to a specific tray is not a function of PostScript but rather a function of my printer itself. So, I had to find the function for my specific printer. I located a PPD file for my printer. Purely by luck (I searched through the file for the word 'tray') I found the following:
*InputSlot 2ndTray-H/Tray 2 (500 Sheets): "
3 dict begin
/MediaPosition 1 def
/DeferredMediaSelection true def
/TraySwitch false def
currentdict end setpagedevice
" *End
I saved this as a file named Dell.ps, without the first and last lines, and with a blank line at the end. Then I used the following command in my program:
<?php ps_include_file($ps, 'Dell.ps'); ?>
It worked!