@@ -100,16 +100,19 @@ public static PdfFileSpec createExternalFileSpec(PdfDocument doc, String filePat
100
100
}
101
101
102
102
/**
103
- * Embed a file to a PdfDocument .
103
+ * Create an embedded file specification .
104
104
*
105
- * @param doc PdfDocument to add the file to
105
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
106
106
* @param fileStore byte[] containing the file
107
107
* @param description file description
108
108
* @param fileDisplay actual file name stored in the pdf
109
- * @param mimeType mime-type of the file
110
- * @param fileParameter Pdfdictionary containing fil parameters
111
- * @param afRelationshipValue AFRelationship key value, @see AFRelationshipValue. If <CODE>null</CODE>, @see AFRelationshipValue.Unspecified will be added.
112
- * @return PdfFileSpec containing the file specification of the file as Pdfobject
109
+ * @param mimeType subtype of the embedded file. The value of this entry shall conform
110
+ * to the MIME media type names
111
+ * @param fileParameter {@link PdfDictionary} containing fil parameters
112
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document
113
+ * that refers to this file specification and the associated file. If <CODE>null</CODE>,
114
+ * {@link PdfName#Unspecified} will be added.
115
+ * @return {@link PdfFileSpec} containing the file specification of the file
113
116
*/
114
117
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , byte [] fileStore , String description , String fileDisplay , PdfName mimeType , PdfDictionary fileParameter , PdfName afRelationshipValue ) {
115
118
PdfStream stream = (PdfStream )new PdfStream (fileStore ).makeIndirect (doc );
@@ -128,73 +131,85 @@ public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, byte[] fileSto
128
131
}
129
132
130
133
/**
131
- * Embed a file to a PdfDocument .
134
+ * Create an embedded file specification .
132
135
*
133
- * @param doc PdfDocument to add the file to
136
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
134
137
* @param fileStore byte[] containing the file
135
138
* @param fileDisplay actual file name stored in the pdf
136
- * @param fileParameter Pdfdictionary containing fil parameters
137
- * @param afRelationshipValue AFRelationship key value, @see AFRelationshipValue. If <CODE>null</CODE>, @see AFRelationshipValue.Unspecified will be added.
138
- * @return PdfFileSpec containing the file specification of the file as Pdfobject
139
+ * @param fileParameter {@link PdfDictionary} containing fil parameters
140
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document
141
+ * that refers to this file specification and the associated file. If <CODE>null</CODE>,
142
+ * {@link PdfName#Unspecified} will be added.
143
+ * @return {@link PdfFileSpec} containing the file specification of the file
139
144
*/
140
145
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , byte [] fileStore , String description , String fileDisplay , PdfDictionary fileParameter , PdfName afRelationshipValue ) {
141
146
return createEmbeddedFileSpec (doc , fileStore , description , fileDisplay , null , fileParameter , afRelationshipValue );
142
147
}
143
148
144
149
145
150
/**
146
- * Embed a file to a PdfDocument .
151
+ * Create an embedded file specification .
147
152
*
148
- * @param doc PdfDocument to add the file to
153
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
149
154
* @param fileStore byte[] containing the file
150
155
* @param fileDisplay actual file name stored in the pdf
151
- * @param fileParameter Pdfdictionary containing fil parameters
152
- * @param afRelationshipValue AFRelationship key value, @see AFRelationshipValue. If <CODE>null</CODE>, @see AFRelationshipValue.Unspecified will be added.
153
- * @return PdfFileSpec containing the file specification of the file as Pdfobject
156
+ * @param fileParameter {@link PdfDictionary} containing fil parameters
157
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
158
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
159
+ * {@link PdfName#Unspecified} will be added.
160
+ * @return {@link PdfFileSpec} containing the file specification of the file
154
161
*/
155
162
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , byte [] fileStore , String fileDisplay , PdfDictionary fileParameter , PdfName afRelationshipValue ) {
156
163
return createEmbeddedFileSpec (doc , fileStore , null , fileDisplay , null , fileParameter , afRelationshipValue );
157
164
}
158
165
159
166
/**
160
- * Embed a file to a PdfDocument .
167
+ * Create an embedded file specification .
161
168
*
162
- * @param doc PdfDocument to add the file to
169
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
163
170
* @param fileStore byte[] containing the file
164
171
* @param fileDisplay actual file name stored in the pdf
165
- * @param afRelationshipValue AFRelationship key value, @see AFRelationshipValue. If <CODE>null</CODE>, @see AFRelationshipValue.Unspecified will be added.
166
- * @return PdfFileSpec containing the file specification of the file as Pdfobject
172
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
173
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
174
+ * {@link PdfName#Unspecified} will be added.
175
+ * @return {@link PdfFileSpec} containing the file specification of the file
167
176
*/
168
177
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , byte [] fileStore , String fileDisplay , PdfName afRelationshipValue ) {
169
178
return createEmbeddedFileSpec (doc , fileStore , null , fileDisplay , null , null , afRelationshipValue );
170
179
}
171
180
172
181
/**
173
- * Embed a file to a PdfDocument .
182
+ * Create an embedded file specification .
174
183
*
175
- * @param doc PdfDocument to add the file to
184
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
176
185
* @param fileStore byte[] containing the file
177
186
* @param description file description
178
187
* @param fileDisplay actual file name stored in the pdf
179
- * @param afRelationshipValue AFRelationship key value, @see AFRelationshipValue. If <CODE>null</CODE>, @see AFRelationshipValue.Unspecified will be added.
180
- * @return PdfFileSpec containing the file specification of the file as Pdfobject
188
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
189
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
190
+ * {@link PdfName#Unspecified} will be added.
191
+ * @return {@link PdfFileSpec} containing the file specification of the file
181
192
*/
182
193
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , byte [] fileStore , String description , String fileDisplay , PdfName afRelationshipValue ) {
183
194
return createEmbeddedFileSpec (doc , fileStore , description , fileDisplay , null , null , afRelationshipValue );
184
195
}
185
196
186
197
187
198
/**
188
- * Embed a file to a PdfDocument .
199
+ * Create an embedded file specification .
189
200
*
190
- * @param doc
191
- * @param filePath
192
- * @param description
193
- * @param fileDisplay
194
- * @param mimeType
195
- * @param fileParameter
196
- * @param afRelationshipValue
197
- * @throws IOException
201
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
202
+ * @param filePath file specification string, describing the path to the file to embed
203
+ * @param description file description
204
+ * @param fileDisplay actual file name stored in the pdf
205
+ * @param mimeType subtype of the embedded file. The value of this entry shall conform
206
+ * to the MIME media type names
207
+ * @param fileParameter dictionary with file parameters
208
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
209
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
210
+ * {@link PdfName#Unspecified} will be added.
211
+ * @return {@link PdfFileSpec} containing the file specification of the file
212
+ * @throws IOException if there are errors while creating an URL from the passed file path.
198
213
*/
199
214
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , String filePath , String description , String fileDisplay , PdfName mimeType , PdfDictionary fileParameter , PdfName afRelationshipValue ) throws IOException {
200
215
PdfStream stream = new PdfStream (doc , UrlUtil .toURL (filePath ).openStream ());
@@ -210,57 +225,71 @@ public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, String filePat
210
225
}
211
226
212
227
/**
213
- * Embed a file to a PdfDocument .
228
+ * Create an embedded file specification .
214
229
*
215
- * @param doc
216
- * @param filePath
217
- * @param description
218
- * @param fileDisplay
219
- * @param mimeType
220
- * @param afRelationshipValue
221
- * @throws IOException
230
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
231
+ * @param filePath file specification string, describing the path to the file to embed
232
+ * @param description file description
233
+ * @param fileDisplay actual file name stored in the pdf
234
+ * @param mimeType subtype of the embedded file. The value of this entry shall conform
235
+ * to the MIME media type names
236
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
237
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
238
+ * {@link PdfName#Unspecified} will be added.
239
+ * @return {@link PdfFileSpec} containing the file specification of the file
240
+ * @throws IOException if there are errors while creating an URL from the passed file path.
222
241
*/
223
242
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , String filePath , String description , String fileDisplay , PdfName mimeType , PdfName afRelationshipValue ) throws IOException {
224
243
return createEmbeddedFileSpec (doc , filePath , description , fileDisplay , mimeType , null , afRelationshipValue );
225
244
}
226
245
227
246
/**
228
- * Embed a file to a PdfDocument .
247
+ * Create an embedded file specification .
229
248
*
230
- * @param doc
231
- * @param filePath
232
- * @param description
233
- * @param fileDisplay
234
- * @param afRelationshipValue
235
- * @throws IOException
249
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
250
+ * @param filePath file specification string, describing the path to the file to embed
251
+ * @param description file description
252
+ * @param fileDisplay actual file name stored in the pdf
253
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
254
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
255
+ * {@link PdfName#Unspecified} will be added.
256
+ * @return @return {@link PdfFileSpec} containing the file specification of the file
257
+ * @throws IOException if there are errors while creating an URL from the passed file path.
236
258
*/
237
259
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , String filePath , String description , String fileDisplay , PdfName afRelationshipValue ) throws IOException {
238
260
return createEmbeddedFileSpec (doc , filePath , description , fileDisplay , null , null , afRelationshipValue );
239
261
}
240
262
241
263
/**
242
- * Embed a file to a PdfDocument .
264
+ * Create an embedded file specification .
243
265
*
244
- * @param doc
245
- * @param filePath
246
- * @param fileDisplay
247
- * @param afRelationshipValue
248
- * @throws IOException
266
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
267
+ * @param filePath path to the file to embed
268
+ * @param fileDisplay actual file name stored in the pdf
269
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
270
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
271
+ * {@link PdfName#Unspecified} will be added.
272
+ * @return {@link PdfFileSpec} containing the file specification of the file
273
+ * @throws IOException if there are errors while creating an URL from the passed file path.
249
274
*/
250
275
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , String filePath , String fileDisplay , PdfName afRelationshipValue ) throws IOException {
251
276
return createEmbeddedFileSpec (doc , filePath , null , fileDisplay , null , null , afRelationshipValue );
252
277
}
253
278
254
279
/**
255
- * Embed a file to a PdfDocument .
280
+ * Create an embedded file specification .
256
281
*
257
- * @param doc
258
- * @param is
259
- * @param description
260
- * @param fileDisplay
261
- * @param mimeType
262
- * @param fileParameter
263
- * @param afRelationshipValue
282
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
283
+ * @param is stream containing the file to embed
284
+ * @param description file description
285
+ * @param fileDisplay actual file name stored in the pdf
286
+ * @param mimeType subtype of the embedded file. The value of this entry shall conform
287
+ * to the MIME media type names
288
+ * @param fileParameter dictionary with file parameters
289
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
290
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
291
+ * {@link PdfName#Unspecified} will be added.
292
+ * @return {@link PdfFileSpec} containing the file specification of the file
264
293
*/
265
294
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , InputStream is , String description , String fileDisplay , PdfName mimeType , PdfDictionary fileParameter , PdfName afRelationshipValue ) {
266
295
PdfStream stream = new PdfStream (doc , is );
@@ -276,28 +305,36 @@ public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, InputStream is
276
305
}
277
306
278
307
/**
279
- * Embed a file to a PdfDocument .
308
+ * Create an embedded file specification .
280
309
*
281
- * @param doc
282
- * @param is
283
- * @param description
284
- * @param fileDisplay
285
- * @param mimeType
286
- * @param afRelationshipValue
310
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
311
+ * @param is stream containing the file to embed
312
+ * @param description file description
313
+ * @param fileDisplay actual file name stored in the pdf
314
+ * @param mimeType subtype of the embedded file. The value of this entry shall conform
315
+ * to the MIME media type names
316
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
317
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
318
+ * {@link PdfName#Unspecified} will be added.
319
+ * @return {@link PdfFileSpec} containing the file specification of the file
287
320
*/
288
321
public static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , InputStream is , String description , String fileDisplay , PdfName mimeType , PdfName afRelationshipValue ) {
289
322
return createEmbeddedFileSpec (doc , is , description , fileDisplay , mimeType , null , afRelationshipValue );
290
323
}
291
324
292
325
/**
293
- * Embed a file to a PdfDocument .
326
+ * Create an embedded file specification .
294
327
*
295
- * @param doc
296
- * @param stream
297
- * @param description
298
- * @param fileDisplay
299
- * @param mimeType
300
- * @param afRelationshipValue
328
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
329
+ * @param stream an embedded file stream dictionary
330
+ * @param description file description
331
+ * @param fileDisplay actual file name stored in the pdf
332
+ * @param mimeType subtype of the embedded file. The value of this entry shall conform
333
+ * to the MIME media type names
334
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
335
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
336
+ * {@link PdfName#Unspecified} will be added.
337
+ * @return {@link PdfFileSpec} containing the file specification of the file
301
338
*/
302
339
private static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , PdfStream stream , String description , String fileDisplay , PdfName mimeType , PdfName afRelationshipValue ) {
303
340
PdfDictionary dict = new PdfDictionary ();
@@ -330,12 +367,15 @@ private static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, PdfStream str
330
367
}
331
368
332
369
/**
333
- * Embed a file to a PdfDocument .
370
+ * Create an embedded file specification .
334
371
*
335
- * @param doc
336
- * @param stream
337
- * @param fileDisplay
338
- * @param afRelationshipValue
372
+ * @param doc {@link PdfDocument} instance to make this file specification indirect
373
+ * @param stream an embedded file stream dictionary
374
+ * @param fileDisplay actual file name stored in the pdf
375
+ * @param afRelationshipValue value that represents the relationship between the component of the passed PDF document that
376
+ * refers to this file specification and the associated file. If <CODE>null</CODE>,
377
+ * {@link PdfName#Unspecified} will be added.
378
+ * @return {@link PdfFileSpec} containing the file specification of the file
339
379
*/
340
380
private static PdfFileSpec createEmbeddedFileSpec (PdfDocument doc , PdfStream stream , String description , String fileDisplay , PdfName afRelationshipValue ) {
341
381
return createEmbeddedFileSpec (doc , stream , description , fileDisplay , null , afRelationshipValue );
0 commit comments