PImport

Imports the specified graphic or text file and sets how the object is to be placed.


Command constructors

This class has two constructors.

PImport(const char * fFilename, short cAsWhat, short bRetain = true, short bConvert = true, short bTags = true, short bRetainCrop = false);

const char * fFilename;
Exact name of file you want to import including optional pathname to folder and disk (maximum of 91 characters for each name and path)
short cAsWhat;
kPlaceIndependent or kPlaceNewStory or 0 (zero)
kPlaceReplaceEntire or kPlaceInlineGraphic or 1
kPlaceInsertText
or kPlaceReplaceText or 2
short bRetain;
false don't import text formatting
true to import text formatting with document (default)
kParmDefault to leave setting unchanged
short bConvert;
false dont convert quotation marks
true to convert quotation marks to typographer's quotation marks (default)
kParmDefault to leave setting unchanged
short bTags;
false to disregard style-name tags, if any, and import the tags as normal text instead
true to format paragraphs using style-name tags in document
kParmDefault to leave setting unchanged
PMBool bRetainCrop;
false to place entire image (default)
true to place image using cropping rectangle of image being replaced (cAsWhat must be kPlaceReplaceEntire)
PImport(const char * fFilename, short cAsWhat, short bRetain, short bConvert, short bTags, short bRetainCrop, PRequestBuf& filters);
const char * fFilename;
Exact name of file you want to import including optional pathname to folder and disk (maximum of 91 characters for each name and path)
short cAsWhat;
kPlaceIndependent or kPlaceNewStory or 0 (zero)
kPlaceReplaceEntire or kPlaceInlineGraphic or 1
kPlaceInsertText
or kPlaceReplaceText or 2
short bRetain;
false dont import text formatting with document
true to import text formatting with document (default)
kParmDefault to leave setting unchanged
short bConvert;
false don't convert quotation marks
trueto convert quotation marks to typographer's quotation marks (default)
kParmDefault to leave setting unchanged
short bTags;
false to disregard style-name tags, if any, and import the tags as normal text instead
true to format paragraphs using style-name tags in document
kParmDefault to leave setting unchanged
PMBool bRetainCrop;
false to place entire image (default)
true to place image using cropping rectangle of image being replaced (cAsWhat must be kPlaceReplaceEntire)
PRequestBuf& filters;
This PRequestBuf object must contain a count (short) value, followed by that many filter names and options. For each filter:

const char * sFltName;

Name of the filter to use if the file is a correct type
const char * sFltOptions;
String composed of options specific to the filter. Separate each option by a space.
Place new or independent stories. Using the kPlaceIndependent or kPlaceNewStory keywords to import does not actually place the file on the page, but displays the appropriate loaded icon. To specify the placement of the file, use the PPlace command.

Immediate file placement. The kPlaceReplaceEntire, kPlaceInlineGraphic, kPlaceInsertText, and kPlaceReplaceText keywords do not display a loaded icon; instead, the file is placed immediately.

cAsWhat: graphics or text. For the cAsWhat parameter, specify kPlaceIndependent, kPlaceReplaceEntire, or kPlaceInlineGraphic when importing graphic files. Specify kPlaceNewStory, kPlaceReplaceEntire, kPlaceReplaceText, or kPlaceInsertText when importing text files.

nFilters, sFltName, and sFltOptions parameters. PageMaker automatically suppresses the filter-option dialog boxes of certain filters when importing through a plug-in. For some filters, you can specify import options using the sFltName and sFltOptions parameters. The options are specific to the named filter and replace those listed in that filter's dialog box. (At this writing, only three filters accept import options from the PImport command: MS Word 6, Text-only, and Kodak Photo CD.)

Note that the sFltName parameter does not dictate which filter PageMaker must use to import the file. (In fact, you can list more than one set of filter and options.) sFltOptions indicates the options PageMaker should use only if the specified file is the correct type for the named filter. Regardless of the filters or options you specify, PageMaker always imports a file using the most appropri ate filter for that file (based on the file extension of Windows files and the file type of Macintosh files).

To locate the correct name for sFltName, see the list of installed filters displayed in the About PageMaker dialog box (select About PageMaker while holding down the Control or Command key). The filter name must match the name in the list, minus the version number.

Macintosh only: PageMaker stories. You cannot import stories from a PageMaker publication using the PImport command.

Word 6.0 import filter. To import an MS Word 6.0 file, use the table below to determine the correct filter name (sFltName):

Importing into... Word file last saved in... sFltName
PM for Macintosh Word 6.0 for Macintosh "MS Word 6 for Macintosh"
PM for Macintosh Word 6.0 for Windows "MS Word 6 for Windows"
PM for Windows Word 6.0 for Windows "MS Word 6 for Windows"
PM for Windows Word 6.0 for Macintosh "MS Word 6 for Windows"

To specify import preferences, include any of the following preference strings for sFltOptions. Optional words are in brackets and represent the default set ting. Enclose multiple preference strings and separate each with a space. (Refer to the Filters ReadMe file for more information on the MS Word 6.0 filter.)

Preference string Action
TOC [TRUE] Import TOC Entries from Outline selected
TOC FALSE Import TOC Entries from Outline turned off
INDEX [TRUE] Import Index Entry Fields selected
INDEX FALSE Import Index Entry Fields turned off
SPACING SET_WIDTH Set Width selected for Import Condensed/Expanded Spacing As
SPACING [MAN_KERN] Kerning selected for Import Condensed/Expanded Spacing AS
SPACING TRACK_KERN Tracking selected for Import Condensed/Expanded Spacing As
PG_BRK_BEFORE [PG_BRK] As Page Break Before selected for Import Page Break Before Paragraph
PG_BRK_BEFORE COL_BRK As Column Break Before selected for Import Page Break Before Paragraph
PG_BRK_BEFORE FALSE Import Page Break Before Paragraph turned off
TABLES [TRUE] Import Tables selected
TABLES FALSE Import Tables turned off

The following example illustrates importing the file "wd6file.doc" using these Word 6 filter options:

import "hard drive: files: wd6file.doc", kPlaceNewStory, true, true, false, false, 1, "MS Word 6 for Macintosh", "TOC FALSE INDEX FALSE SPACING TRACK_KERN PG_BRK_BEFORE FALSE TABLES TRUE"

Text-only filter. To specify import options for a text-only file, use "Text-only" for sFltName, and for sFltOptions, use the following strings. Enclose multiple options and separate each with a space.

Preference string Action
STRIP_LINE_CRS To remove extra carriage returns at the end of every line. (Use on the Macintosh when importing a text file created in Windows.)
STRIP_PARA_CRS To remove extra carriage returns between paragraphs.
PRESERVE_TABLES_LISTS To leave tables, lists, and indents unchanged when stripping the extra carriage return either at the end of each line or between paragraphs (sFltOptions must include either STRIP_LINE_CRS or STRIP_PARA_CRS to use this string).
REPLACE_SPACES [number] To replace any occurrence of the specified number or more spaces with a tab. If you do not specify a number, the import filter will use the default value of 3.
MONOSPACE To apply the monospace Courier font to the im ported text.
AS_IS To import the text as is, with no conversion op tions.
ASCII (Windows only) To import an ASCII text-only file.
ANSI (Windows only) To import an ANSI text-only file.

Kodak Photo CD import filter. To specify import options for the Kodak Photo CD filter, specify "Kodak Photo CD" for sFltName, and for sFltOptions, specify a combination of the following strings (case is not important). Enclose the options and separate each with a space.

Preference String Action
Gray To import an 8-bit grayscale image
RGB To import a 32-bit RGB color image
WHITEN To turn on auto-color balance
ROTATE90 To rotate the image 90 degrees counter clockwise
ROTATE180 To rotate the image 180 degrees
ROTATE270 To rotate the image 270 degrees counter clockwise
MIRROR0 To mirror the image left to right
MIRROR90 To mirror and rotate the image 90 degrees counter clockwise
MIRROR180 To mirror and rotate the image 180 degrees
MIRROR270 To mirror and rotate the image 270 degrees counter clockwise
SHARPEN_LEVEL # To sharpen the image using one of three sharpen ing levels, where # is the integer 1 (lowest level), 2 (medium level), or 3 (highest level)
OUTPUT_WIDTH # To size the image to the specified width, where # is in pixels (or the specified units; see measure units table below). The default width is 6 inches
OUTPUT-HEIGHT # To size the image to the specified height, where # is in pixels (or the specified units; see measure units table below). The default height is 4 inches
OUTPUT_RES_DPI # To set the resolution of the image in pixels per inch, where # is an integer
OUTPUT_RES_DPMM # To set the resolution of the image in pixels per millimeter, where # is an integer
CROP_RECT #left, #right, #top, #bottom To crop the image to the specified pixel coordinates, where #left, #right, #top, #bottom are relative to the base image size (512 x 768 pixels for landscape images and 768 x 512 pixels for portrait images). The zero point of an image is its left-top corner. So, the bottom-right coordinates are (768, 512) for a landscape image and (512, 768) for a portrait image.
TIFF_PATH 'filename' To import the image and save it as a TIFF file. Enclose the full path, including hard disk, in single quotation marks (maximum of 255 characters).

The following table lists the measurement abbreviations you use to specify the units in the strings OUTPUT_WIDTH and OUTPUT_HEIGHT:

System Abbreviation Example
Inches i after 5.625i
Millimeters m after 25m
Picas p after 18p
Points p before p6
Picas and points p between 18p6
Ciceros c after 5c
Ciceros and didot points c between 28c6

Note. Do not insert a space between the measurement and the abbreviation.

Example. The following example imports a text file, places it at the insertion point, retains the word-processing style sheet used when the text file was created, converts straight quotation marks to typographer's quotation marks, and does not read style-name tags.

PImport("mydisk:myfolder:myfile", kPlaceIndependent, true, true, false);

The following example imports the "World View.pcd" graphics file. If the Kodak Photo CD import filter is used, the image is imported in RGB format with a 2048 by 3072 pixel resolution.

PImport "HD200:World View.pcd", kPlaceIndependent, true, true, false, false, 1, "Kodak Photo CD", "rgb 2048x3072");


See also

The PGetImportFilters query

Adobe PageMaker 6.5 Help > Commands > File > Place


Copyright © 1996, Adobe Systems Incorporated. All rights reserved.

Comments or suggestions? Contact Adobe Developer Support