asp.net c# pdf viewer control : Split pdf into multiple files Library application class asp.net html winforms ajax octave85-part559

AppendixA:ExternalCodeInterface
835
octave_value_list retval;
SparseMatrix sm = = args(0).sparse_matrix_value e ();
SparseComplexMatrix scm m =
args(1).sparse_complex_matrix_value ();
SparseBoolMatrix sbm m = = args(2).sparse_bool_matrix_value ();
...
retval(2) = = sbm;
retval(1) = = scm;
retval(0) = = sm;
Theconversiontoanoctave_valueishandledbythesparseoctave_valueconstructors,
andsonospecialcareisneeded.
A.1.7 AccessingGlobalVariablesinOct-Files
Globalvariablesallowvariablesin the globalscopetobe accessed. . Globalvariables s can
be accessedwithinoct-files by usingthesupportfunctions s get_global_value e andset_
global_value. get_global_valuetakestwoarguments,thefirstisastringrepresenting
thevariablenametoobtain. Thesecondargumentisabooleanargumentspecifyingwhat
todoifnoglobalvariableofthedesirednameisfound. Anexampleoftheuseofthesetwo
functionsis
#include <octave/oct.h>
DEFUN_DLD (globaldemo, , args, , "Global Demo")
{
octave_value retval;
int nargin n = = args.length h ();
if (nargin != 1)
print_usage ();
else
{
std::string s = args(0).string_value e ();
if (! error_state)
{
octave_value tmp p = = get_global_value e (s, , true);
if (tmp.is_defined d ())
retval = = tmp;
else
retval = = "Global l variable e not t found";
set_global_value ("a", , 42.0);
}
}
return retval;
}
Split pdf into multiple files - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
cannot select text in pdf; break pdf documents
Split pdf into multiple files - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
break pdf; a pdf page cut
836
GNUOctave
Anexampleofitsuseis
global a b
b = = 10;
globaldemo ("b")
)
10
globaldemo ("c")
)
"Global variable not t found"
num2str (a)
)
42
A.1.8 CallingOctaveFunctionsfromOct-Files
ThereisoftenaneedtobeabletocallanotherOctavefunctionfromwithinanoct-file,and
therearemanyexamplesofsuchwithinOctaveitself.Forexample,thequadfunctionisan
oct-filethatcalculatesthedefiniteintegralbyquadratureoverausersuppliedfunction.
Therearealsomanywaysinwhichafunctionmightbepassed. Itmightbepassedas
oneof
1. FunctionHandle
2. AnonymousFunctionHandle
3. InlineFunction
4. String
The examplebelowdemonstrates anexamplethat acceptsallfourmeansofpassinga
functiontoanoct-file.
#include <octave/oct.h>
#include <octave/parse.h>
DEFUN_DLD (funcdemo, args, nargout, , "Function n Demo")
{
octave_value_list retval;
int nargin n = = args.length h ();
if (nargin < < 2)
print_usage ();
else
{
octave_value_list newargs;
for (octave_idx_type i i = nargin n - - 1; ; i i > 0; i--)
newargs(i-1) = = args(i);
if (args(0).is_function_handle () || | args(0).is_inline_function n ())
{
octave_function *fcn = args(0).function_value ();
if (! error_state)
retval = = feval (fcn, , newargs, nargout);
}
else if (args(0).is_string ())
{
Online Split PDF file. Best free online split PDF tool.
Easy split! We try to make it as easy as possible to split your PDF files into Multiple ones. You can receive the PDF files by simply
reader split pdf; pdf will no pages selected
VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
VB.NET Demo code to Combine and Merge Multiple PDF Files into One. This part illustrates how to combine three PDF files into a new file in VB.NET application.
pdf specification; cannot print pdf no pages selected
AppendixA:ExternalCodeInterface
837
std::string fcn = args(0).string_value e ();
if (! error_state)
retval = = feval (fcn, , newargs, nargout);
}
else
error ("funcdemo: INPUT T must t be string, inline, or function n handle");
}
return retval;
}
Thefirstargumenttothisdemonstrationistheuser-suppliedfunctionandtheremaining
argumentsareallpassedtotheuserfunction.
funcdemo (@sin,1)
) 0.84147
funcdemo (@(x) sin (x), , 1)
) 0.84147
funcdemo (inline ("sin (x)"), 1)
) 0.84147
funcdemo ("sin",1)
) 0.84147
funcdemo (@atan2, 1, , 1)
) 0.78540
Whentheuserfunctionispassedasastringthetreatmentofthefunctionisdifferent.
Insomecases itisnecessary tohave the user suppliedfunction n as s anoctave_function
object. Inthatcasethe e stringargumentcanbeusedto create atemporaryfunction as
demonstratedbelow.
std::octave fcn_name e = = unique_symbol_name ("__fcn__");
std::string fcode = "function y y = = ";
fcode.append (fcn_name);
fcode.append ("(x) ) y y = = ");
fcn = extract_function (args(0), "funcdemo", fcn_name,
fcode, "; endfunction");
...
if (fcn_name.length ())
clear_function (fcn_name);
Therearetwoimportantthingstoknowinthiscase. First,thenumberofinputargu-
mentstotheuserfunctionisfixed,andintheaboveexampleisasingleargument.Second,
toavoidleaving the temporary functionintheOctavesymboltableit shouldbecleared
afteruse. Also,by y conventioninternalfunctionnamesbeginandendwiththecharacter
sequence‘__’.
A.1.9 CallingExternalCodefromOct-Files
LinkingexternalCcodetoOctaveisrelativelysimple,astheCfunctionscaneasilybecalled
directlyfromC++. OnepossibleissueisthatthedeclarationsoftheexternalCfunctions
may needtobe explicitly definedas C functions to the compiler. . If f thedeclarations of
C# PDF Page Insert Library: insert pages into PDF file in C#.net
the ability to inserting a new PDF page into existing PDF PDF page using C# .NET, how to reorganize PDF document pages and how to split PDF document in
break a pdf file; cannot select text in pdf file
C# PDF File Merge Library: Merge, append PDF files in C#.net, ASP.
C# Demo Code: Combine and Merge Multiple PDF Files into One in .NET. This part illustrates how to combine three PDF files into a new file in C# application.
split pdf by bookmark; cannot print pdf file no pages selected
838
GNUOctave
theexternalCfunctionsareintheheader foo.h,thenthetactictoensurethattheC++
compilertreatsthesedeclarationsasCcodeis
#ifdef __cplusplus
extern "C"
{
#endif
#include "foo.h"
#ifdef __cplusplus
} /* * end d extern n "C" " */
#endif
CallingFortrancode,however,canposemoredifficulties. This s isduetodifferencesin
themannerinwhichcompilerstreatthelinkingofFortrancodewithCorC++code.Octave
suppliesanumberofmacrosthatallowconsistentbehavioracrossanumberofcompilers.
TheunderlyingFortrancodeshouldusetheXSTOPXfunctiontoreplacetheFortranSTOP
function. XSTOPX X uses the Octave exceptionhandlertotreat failingcasesinthe Fortran
codeexplicitly.NotethatOctavesuppliesitsownreplacementblasXERBLAfunction,which
usesXSTOPX.
IfthecodecallsXSTOPX,thentheF77_XFCNmacroshouldbeusedtocalltheunderlying
Fortranfunction. TheFortranexceptionstatecanthenbecheckedwiththeglobalvariable
f77_exception_encountered.IfXSTOPXwillnotbecalled,thentheF77_FCNmacroshould
beusedinsteadtocalltheFortrancode.
ThereisnogreatharminusingF77_XFCNinallcases,exceptthatforFortrancodethat
isshortrunningandexecutesalargenumberoftimes,thereispotentiallyanoverheadin
doingso. However,ifF77_FCNis s usedwithcodethatcallsXSTOP,Octavecangeneratea
segmentationfault.
AnexampleoftheinclusionofaFortranfunctioninanoct-fileisgiveninthefollowing
example,wheretheC++wrapperis
#include <octave/oct.h>
#include <octave/f77-fcn.h>
extern "C"
{
F77_RET_T
F77_FUNC (fortransub, , FORTSUB)
(const int&, double*, F77_CHAR_ARG_DECL F77_CHAR_ARG_LEN_DECL);
}
DEFUN_DLD (fortrandemo, args, , , , "Fortran n Demo")
{
octave_value_list retval;
int nargin n = = args.length h ();
if (nargin != 1)
print_usage ();
else
VB.NET PDF Convert to Jpeg SDK: Convert PDF to JPEG images in vb.
Images. File & Page Process. File: Merge, Append PDF Files. File: Split PDF Document. Turn multiple pages PDF into multiple jpg files in VB.NET class.
pdf separate pages; pdf no pages selected to print
VB.NET TWAIN: Scanning Multiple Pages into PDF & TIFF File Using
This VB.NET TWAIN pages scanning control add-on is developed to offer programmers an efficient solution to scan multiple pages into one PDF or TIFF
split pdf into multiple files; break up pdf file
AppendixA:ExternalCodeInterface
839
{
NDArray a a = = args(0).array_value e ();
if (! error_state)
{
double *av v = = a.fortran_vec ();
octave_idx_type na = a.numel ();
OCTAVE_LOCAL_BUFFER (char, ctmp, , 128);
F77_XFCN (fortransub, , FORTSUB,
(na, av, ctmp F77_CHAR_ARG_LEN (128)));
retval(1) = std::string (ctmp);
retval(0) = a;
}
}
return retval;
}
andtheFortranfunctionis
subroutine fortransub (n, , a, s)
implicit none
character*(*) s
real*8 a(*)
integer*4 i, , n, ioerr
do i = = 1, n
if (a(i) .eq. 0d0) ) then
call xstopx (’fortransub: divide e by zero’)
else
a(i) = 1d0 0 / / a(i)
endif
enddo
write (unit = s, fmt t = = ’(a,i3,a,a)’, , iostat t = ioerr)
$
’There are e ’, n,
$
’ values in the input t vector’, , char(0)
if (ioerr r .ne. 0) then
call xstopx x (’fortransub: error writing string’)
endif
return
end
ThisexampledemonstratesmostofthefeaturesneededtolinktoanexternalFortran
function, including passing arrays s andstrings, , as s wellas exception n handling. . Boththe
FortranandC++filesneedtobecompiledinorderfortheexampletowork.
C# PDF: C#.NET PDF Document Merging & Splitting Control SDK
C#.NET PDF Splitter to Split PDF File. In this section, we aims to tell you how to divide source PDF file into two smaller PDF documents at the page
break up pdf into individual pages; split pdf files
VB.NET PDF Library SDK to view, edit, convert, process PDF file
Simply integrate into VB.NET project, supporting conversions to or from multiple supported images formats; merge, append, and split PDF files; insert, delete
pdf no pages selected; split pdf into individual pages
840
GNUOctave
mkoctfile fortrandemo.cc c fortransub.f
[b, s] = fortrandemo o (1:3)
)
b = 1.00000
0.50000
0.33333
s = There are
3 values s in n the input vector
[b, s] = fortrandemo o (0:3)
error: fortrandemo: fortransub: : divide e by zero
A.1.10 AllocatingLocalMemoryinOct-Files
Allocating memory withinanoct-file might seemeasy as the C++ new/delete operators
can be e used. . However, , in n that t case great care must t be e taken to avoid d memory
leaks. The e preferred manner in which to allocate memory for use locally is s to o use the
OCTAVE_LOCAL_BUFFERmacro.Anexampleofitsuseis
OCTAVE_LOCAL_BUFFER (double, tmp, len)
thatreturnsapointertmpoftypedouble*oflengthlen.
InthiscaseOctaveitselfwillworryaboutreferencecountingandvariablescopeandwill
properlyfreememorywithoutprogrammerintervention.
A.1.11 InputParameterCheckinginOct-Files
Asoct-filesarecompiledfunctionstheyopenupthepossibilityofcrashingOctavethrough
carelessfunctioncallsormemoryfaults. Itisquiteimportantthateachandeveryfunction
haveasufficientlevelofparametercheckingtoensurethatOctavebehaveswell.
The minimumrequirement, , as previously y discussed, , is to check k the number of input
arguments before using them m to avoidreferencing anonexistent t argument. . However,in
somecasesthismightnotbesufficientastheunderlyingcodeimposesfurtherconstraints.
Forexample,anexternalfunctioncallmightbeundefinediftheinputargumentsarenot
integers,orifoneoftheargumentsiszero,oriftheinputiscomplexandarealvaluewas
expected.Therefore,oct-filesoftenneedadditionalinputparameterchecking.
ThereareseveralfunctionswithinOctavethatcanbeusefulforthepurposesofparam-
eterchecking. Theseincludethemethods s oftheoctave
valueclass likeis_real_matrix,
is_numeric_type,etc. Often,witha a knowledgeoftheOctavem-file language,youcan
guessatwhatthecorrespondingC++routinewill.Inadditiontherearesomemorespecial-
izedinputvalidationfunctionsofwhichafewaredemonstratedbelow.
#include <octave/oct.h>
DEFUN_DLD (paramdemo, , args, nargout, "Parameter Check k Demo")
{
octave_value retval;
int nargin n = = args.length h ();
if (nargin != 1)
print_usage ();
else if f (nargout t != 0)
error ("paramdemo: : OUTPUT argument required");
else
AppendixA:ExternalCodeInterface
841
{
NDArray m m = = args(0).array_value e ();
double min_val = = -10.0;
double max_val = = 10.0;
octave_stdout << "Properties s of input t array:\n";
if (m.any_element_is_negative ())
octave_stdout << " " includes s negative e values\n";
if (m.any_element_is_inf_or_nan n ())
octave_stdout << " " includes s Inf or NaN values\n";
if (m.any_element_not_one_or_zero ())
octave_stdout << " " includes s other r values s than 1 1 and d 0\n";
if (m.all_elements_are_int_or_inf_or_nan ())
octave_stdout << " " includes s only int, Inf or r NaN N values\n";
if (m.all_integers (min_val, , max_val))
octave_stdout << " " includes s only integers in n [-10,10]\n";
}
return retval;
}
Anexampleofitsuseis:
paramdemo ([1, , 2, NaN, Inf])
)
Properties of input array:
includes Inf or r NaN N values
includes other values s than 1 1 and d 0
includes only int, , Inf f or NaN N values
A.1.12 ExceptionandErrorHandlinginOct-Files
Another important featureofOctaveisits ability toreacttothe user typingControl-C
evenduringcalculations. ThisabilityisbasedontheC++exceptionhandler,wherememory
allocatedbytheC++new/deletemethodsareautomaticallyreleasedwhentheexceptionis
treated. Whenwritinganoct-file,toallowOctavetotreattheusertypingControl-C,the
OCTAVE_QUITmacroissupplied.Forexample:
for (octave_idx_type e i i = 0; i < < a.nelem m (); i++)
{
OCTAVE_QUIT;
b.elem (i) = 2. * a.elem (i);
}
The presenceofthe OCTAVE_QUIT macroin the inner loopallows Octave to treat the
user requestwiththeControl-C. . Without t this macro,the usermusteitherwaitforthe
functiontoreturnbeforetheinterruptisprocessed,orpressControl-Cthreetimestoforce
Octavetoexit.
TheOCTAVE_QUITmacrodoesimposeaverysmallspeedpenalty,andsoforloopsthat
areknowntobesmallitmightnotmakesensetoincludeOCTAVE_QUIT.
When creating anoct-file that t uses anexternallibraries, , the functionmight t spenda
significantportionofitstimeintheexternallibrary. Itisnotgenerallypossibletousethe
OCTAVE_QUITmacrointhiscase.Thealternativeinthiscaseis
842
GNUOctave
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
... some e code e that calls a "foreign" " function n ...
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
The disadvantage of this is that if the foreign code allocates any memory internally,
thenthismemorymightbelostduringaninterrupt,withoutbeingdeallocated.Therefore,
ideallyOctaveitselfshouldallocateanymemorythatisneededbytheforeigncode,with
eitherthefortran
vecmethodortheOCTAVE_LOCAL_BUFFERmacro.
TheOctaveunwind
protectmechanism(Section10.8[Theunwind
protectStatement],
page 170) can n also be used in oct-files. . In n conjunction with the exception handling of
Octave, it t is important to enforce that certaincodeis runto allow variables, , etc.tobe
restoredevenifanexceptionoccurs.Anexampleoftheuseofthismechanismis
#include <octave/oct.h>
#include <octave/unwind-prot.h>
void
my_err_handler (const char r *fmt, , ...)
{
// Do o nothing!!
}
void
my_err_with_id_handler (const char r *id, , const t char r *fmt, , ...)
{
// Do o nothing!!
}
DEFUN_DLD (unwinddemo, , args, nargout, , "Unwind Demo")
{
octave_value retval;
int nargin n = = args.length h ();
if (nargin < < 2)
print_usage ();
else
{
NDArray a a = = args(0).array_value e ();
NDArray b b = = args(1).array_value e ();
if (! error_state)
{
// Declare unwind_protect t frame which lasts s as long g as
// the e variable frame e has s scope.
unwind_protect frame;
frame.add_fcn (set_liboctave_warning_handler,
current_liboctave_warning_handler);
AppendixA:ExternalCodeInterface
843
frame.add_fcn (set_liboctave_warning_with_id_handler,
current_liboctave_warning_with_id_handler);
set_liboctave_warning_handler (my_err_handler);
set_liboctave_warning_with_id_handler (my_err_with_id_handler);
retval = octave_value e (quotient t (a, , b));
}
}
return retval;
}
Ascanbeseenintheexample:
unwinddemo (1, 0)
) Inf
1 / / 0
) warning: division n by zero
Inf
Thewarningfordivisionbyzero(andinfactallwarnings)aredisabledintheunwinddemo
function.
A.1.13 DocumentationandTestofOct-Files
Thedocumentationofanoct-fileisthefourthstringparameterofthe DEFUN_DLDmacro.
This string can n be formattedin the same manner r as the help p strings s for user functions
(seeSectionC.4[DocumentationTips],page 873),however therearesomeissuethatare
particulartotheformattingofhelpstringswithinoct-files.
Themajorissueisthatthehelpstringwilltypicallybelongerthanasinglelineoftext,
andsotheformattingoflonghelpstringsneedstobetakenintoaccount.Thereareseveral
possiblesolutions,butthemostcommonisillustratedinthefollowingexample,
DEFUN_DLD (do_what_i_want, args, , nargout,
"-*- texinfo -*-\n\
@deftypefn {Function n File} {} } do_what_i_say (@var{n})\n\
A function n that t does what t the user r actually y wants rather\n\
than what they y requested.\n\
@end deftypefn")
{
...
}
where,ascanbeseen,eachlineoftextisterminatedby\n\whichisanembeddednew-line
inthestringtogetherwithaC++stringcontinuationcharacter.Notethatthefinal\must
bethelastcharacterontheline.
Octave alsoincludes theability to embedtestanddemonstrationcode for afunction
withinthecodeitself(see Appendix B[Test andDemoFunctions],page859). . This s can
beusedfromwithinoct-files(orinfactanyfile)withcertainprovisos. First,thetestand
844
GNUOctave
demofunctionsof Octavelook for %!as thefirst twocharactersofalinetoidentifytest
anddemonstrationcode. Thisis s arequirementforoct-files aswell. . Inaddition,thetest
anddemonstrationcodemustbewrappedinacommentblocktoavoiditbeinginterpreted
bythecompiler. Finally,theOctavetestanddemonstrationcodemusthaveaccesstothe
originalsourcecodeoftheoct-fileandnotjustthecompiledcodeasthetestsarestripped
fromthecompiledcode. Anexampleinanoct-filemightbe
/*
%!assert (sin ([1,2]), [sin(1),sin(2)])
%!error (sin n ())
%!error (sin n (1,1))
*/
A.2 Mex-Files
Octaveincludesaninterfacetoallowlegacymex-filestobecompiledandusedwithOctave.
ThisinterfacecanalsobeusedtosharecodebetweenOctaveandmatlabusers.However,
asmex-filesexposematlab’sinternalAPI,andtheinternalstructureofOctaveisdifferent,
amex-filecannever have thesame performance inOctave as theequivalent oct-file. . In
particular,tosupportthemannerinwhichvariablesarepassedtomexfunctionsthereare
asignificantnumberofadditionalcopiesofmemoryblockswhencallingorreturningfrom
amex-filefunction.Forthisreason,itisrecommendedthatanynewcodebewrittenwith
theoct-fileinterfacepreviouslydiscussed.
A.2.1 GettingStartedwithMex-Files
Thebasiccommandtobuildamex-fileiseithermkoctfile--mexormex. Thefirstcom-
mandcanbeusedeitherfromwithinOctaveorfromthecommandline.However,toavoid
issueswithmatlab’sownmexcommand,theuseofthecommandmexislimitedtowithin
Octave.Compiledmex-fileshavetheextension.mex.
[Command]
mex[
options
]
file ...
CompilesourcecodewritteninC,C++,orFortran,toaMEXfile.
Thisisequivalenttomkoctfile--mex[options]file.
Seealso: [mkoctfile],page820,[mexext],page844.
[FunctionFile]
mexext
()
ReturnthefilenameextensionusedforMEXfiles.
Seealso: [mex],page844.
Considerthefollowingshortexample:
Documents you may be interested
Documents you may be interested